Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Nihilazo | 5cbd9b58a7 | |
Nihilazo | 1dfe6da904 | |
Nihilazo | aaef09ea54 |
Binary file not shown.
After Width: | Height: | Size: 12 KiB |
|
@ -0,0 +1,34 @@
|
||||||
|
[remap]
|
||||||
|
|
||||||
|
importer="texture"
|
||||||
|
type="StreamTexture"
|
||||||
|
path="res://.import/bare_tree.png-8e3f706bd49c6629bd8ef416386571ce.stex"
|
||||||
|
metadata={
|
||||||
|
"vram_texture": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[deps]
|
||||||
|
|
||||||
|
source_file="res://assets/bare_tree.png"
|
||||||
|
dest_files=[ "res://.import/bare_tree.png-8e3f706bd49c6629bd8ef416386571ce.stex" ]
|
||||||
|
|
||||||
|
[params]
|
||||||
|
|
||||||
|
compress/mode=0
|
||||||
|
compress/lossy_quality=0.7
|
||||||
|
compress/hdr_mode=0
|
||||||
|
compress/bptc_ldr=0
|
||||||
|
compress/normal_map=0
|
||||||
|
flags/repeat=0
|
||||||
|
flags/filter=true
|
||||||
|
flags/mipmaps=false
|
||||||
|
flags/anisotropic=false
|
||||||
|
flags/srgb=2
|
||||||
|
process/fix_alpha_border=true
|
||||||
|
process/premult_alpha=false
|
||||||
|
process/HDR_as_SRGB=false
|
||||||
|
process/invert_color=false
|
||||||
|
stream=false
|
||||||
|
size_limit=0
|
||||||
|
detect_3d=true
|
||||||
|
svg/scale=1.0
|
Binary file not shown.
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 9.2 KiB |
BIN
assets/tree.png
BIN
assets/tree.png
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 12 KiB |
|
@ -19,6 +19,12 @@ config/name="giraffesnake"
|
||||||
run/main_scene="res://scenes/World.tscn"
|
run/main_scene="res://scenes/World.tscn"
|
||||||
config/icon="res://icon.png"
|
config/icon="res://icon.png"
|
||||||
|
|
||||||
|
[display]
|
||||||
|
|
||||||
|
window/size/width=1920
|
||||||
|
window/size/height=1080
|
||||||
|
window/stretch/mode="2d"
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
left={
|
left={
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
[gd_scene format=2]
|
||||||
|
|
||||||
|
[node name="DeathScreen" type="PopupPanel"]
|
||||||
|
pause_mode = 2
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
margin_left = -960.0
|
||||||
|
margin_top = -540.0
|
||||||
|
margin_right = 960.0
|
||||||
|
margin_bottom = 540.0
|
||||||
|
popup_exclusive = true
|
||||||
|
|
||||||
|
[node name="Box" type="VBoxContainer" parent="."]
|
||||||
|
margin_right = 40.0
|
||||||
|
margin_bottom = 40.0
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Header" type="Label" parent="Box"]
|
||||||
|
margin_right = 61.0
|
||||||
|
margin_bottom = 31.0
|
||||||
|
text = "You Died!
|
||||||
|
"
|
||||||
|
__meta__ = {
|
||||||
|
"_edit_use_anchors_": false
|
||||||
|
}
|
||||||
|
|
||||||
|
[node name="Score" type="Label" parent="Box"]
|
||||||
|
margin_top = 35.0
|
||||||
|
margin_right = 61.0
|
||||||
|
margin_bottom = 49.0
|
||||||
|
text = "Score: "
|
|
@ -3,12 +3,15 @@
|
||||||
[ext_resource path="res://assets/giraffe_head.png" type="Texture" id=1]
|
[ext_resource path="res://assets/giraffe_head.png" type="Texture" id=1]
|
||||||
[ext_resource path="res://scripts/GiraffeHead.gd" type="Script" id=2]
|
[ext_resource path="res://scripts/GiraffeHead.gd" type="Script" id=2]
|
||||||
|
|
||||||
[sub_resource type="RectangleShape2D" id=1]
|
[sub_resource type="CapsuleShape2D" id=1]
|
||||||
|
radius = 39.8424
|
||||||
|
height = 10.5097
|
||||||
|
|
||||||
[node name="GiraffeHead" type="KinematicBody2D"]
|
[node name="GiraffeHead" type="KinematicBody2D"]
|
||||||
script = ExtResource( 2 )
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2( 9.54593, -0.353554 )
|
||||||
shape = SubResource( 1 )
|
shape = SubResource( 1 )
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[node name="Sprite" type="Sprite" parent="."]
|
||||||
|
|
|
@ -1,8 +1,33 @@
|
||||||
[gd_scene load_steps=2 format=2]
|
[gd_scene load_steps=7 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://assets/tree.png" type="Texture" id=1]
|
[ext_resource path="res://assets/tree.png" type="Texture" id=1]
|
||||||
|
[ext_resource path="res://scripts/Tree.gd" type="Script" id=2]
|
||||||
|
[ext_resource path="res://assets/bare_tree.png" type="Texture" id=3]
|
||||||
|
|
||||||
[node name="Tree" type="Node2D"]
|
[sub_resource type="SpriteFrames" id=1]
|
||||||
|
animations = [ {
|
||||||
|
"frames": [ ExtResource( 1 ), ExtResource( 3 ) ],
|
||||||
|
"loop": true,
|
||||||
|
"name": "default",
|
||||||
|
"speed": 5.0
|
||||||
|
} ]
|
||||||
|
|
||||||
[node name="Sprite" type="Sprite" parent="."]
|
[sub_resource type="RectangleShape2D" id=2]
|
||||||
texture = ExtResource( 1 )
|
extents = Vector2( 112.784, 53.9413 )
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id=3]
|
||||||
|
extents = Vector2( 50.4981, 83.1256 )
|
||||||
|
|
||||||
|
[node name="Tree" type="KinematicBody2D"]
|
||||||
|
script = ExtResource( 2 )
|
||||||
|
|
||||||
|
[node name="Sprite" type="AnimatedSprite" parent="."]
|
||||||
|
frames = SubResource( 1 )
|
||||||
|
|
||||||
|
[node name="Leaves" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2( 0.629959, -28.6632 )
|
||||||
|
shape = SubResource( 2 )
|
||||||
|
|
||||||
|
[node name="Trunk" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2( -57.0114, 4.03472 )
|
||||||
|
shape = SubResource( 3 )
|
||||||
|
|
|
@ -1,12 +1,23 @@
|
||||||
[gd_scene load_steps=3 format=2]
|
[gd_scene load_steps=5 format=2]
|
||||||
|
|
||||||
[ext_resource path="res://scenes/GiraffeHead.tscn" type="PackedScene" id=1]
|
[ext_resource path="res://scenes/GiraffeHead.tscn" type="PackedScene" id=1]
|
||||||
[ext_resource path="res://scenes/Tree.tscn" type="PackedScene" id=2]
|
[ext_resource path="res://scenes/Tree.tscn" type="PackedScene" id=2]
|
||||||
|
[ext_resource path="res://scripts/World.gd" type="Script" id=3]
|
||||||
|
[ext_resource path="res://scenes/DeathScreen.tscn" type="PackedScene" id=4]
|
||||||
|
|
||||||
[node name="World" type="Node2D"]
|
[node name="World" type="Node2D"]
|
||||||
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="GiraffeHead" parent="." instance=ExtResource( 1 )]
|
[node name="GiraffeHead" parent="." instance=ExtResource( 1 )]
|
||||||
position = Vector2( 362.448, 402.091 )
|
position = Vector2( 1089.79, 940.571 )
|
||||||
|
|
||||||
[node name="Tree" parent="." instance=ExtResource( 2 )]
|
[node name="Tree" parent="." instance=ExtResource( 2 )]
|
||||||
position = Vector2( 118.928, 186.887 )
|
position = Vector2( 748, 463.862 )
|
||||||
|
|
||||||
|
[node name="DeathScreen" parent="." instance=ExtResource( 4 )]
|
||||||
|
margin_left = 820.184
|
||||||
|
margin_top = 537.476
|
||||||
|
margin_right = 889.184
|
||||||
|
margin_bottom = 594.476
|
||||||
|
[connection signal="death" from="Tree" to="." method="_on_Tree_death"]
|
||||||
|
[connection signal="eaten" from="Tree" to="." method="_on_Tree_eaten"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
extends KinematicBody2D
|
extends KinematicBody2D
|
||||||
|
|
||||||
export var speed = 50
|
export var speed = 5
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
@ -8,7 +8,9 @@ func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
var input_movement = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left"))
|
if Input.is_action_pressed("right"):
|
||||||
|
self.move_and_collide(Vector2(speed,0))
|
||||||
|
$Sprite.flip_h = true
|
||||||
self.move_and_slide(Vector2(input_movement * speed, 0), Vector2(0, -1))
|
elif Input.is_action_pressed("left"):
|
||||||
|
$Sprite.flip_h = false
|
||||||
|
self.move_and_collide(Vector2(-speed,0))
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
extends KinematicBody2D
|
||||||
|
|
||||||
|
signal death
|
||||||
|
signal eaten
|
||||||
|
onready var speed = 1
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
set_physics_process(true)
|
||||||
|
|
||||||
|
func _physics_process(delta):
|
||||||
|
var col = self.move_and_collide(Vector2(0,speed))
|
||||||
|
if col != null and col.local_shape == $Leaves:
|
||||||
|
$Sprite.frame = 1
|
||||||
|
emit_signal("eaten")
|
||||||
|
$Leaves.disabled = true
|
||||||
|
elif col != null and col.local_shape == $Trunk:
|
||||||
|
emit_signal("death")
|
|
@ -0,0 +1,21 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
var score = 0
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
#func _process(delta):
|
||||||
|
# pass
|
||||||
|
|
||||||
|
func _on_Tree_eaten():
|
||||||
|
score += 1
|
||||||
|
|
||||||
|
func _on_Tree_death():
|
||||||
|
get_tree().paused = true
|
||||||
|
$DeathScreen/Box/Score.text = "Score: " + str(score)
|
||||||
|
$DeathScreen.popup_centered()
|
Loading…
Reference in New Issue