leaves are now edible! Also other stuff

nihilazo
Nihilazo 2021-02-13 19:46:37 +00:00
parent fe5c4fdfad
commit aaef09ea54
10 changed files with 99 additions and 11 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@ -19,6 +19,12 @@ config/name="giraffesnake"
run/main_scene="res://scenes/World.tscn"
config/icon="res://icon.png"
[display]
window/size/width=1920
window/size/height=1080
window/stretch/mode="2d"
[input]
left={

View File

@ -3,12 +3,15 @@
[ext_resource path="res://assets/giraffe_head.png" type="Texture" id=1]
[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"]
script = ExtResource( 2 )
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2( 9.54593, -0.353554 )
shape = SubResource( 1 )
[node name="Sprite" type="Sprite" parent="."]

View File

@ -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://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=2]
animations = [ {
"frames": [ ExtResource( 1 ), ExtResource( 3 ) ],
"loop": true,
"name": "default",
"speed": 5.0
} ]
[node name="Sprite" type="Sprite" parent="."]
texture = ExtResource( 1 )
[sub_resource type="RectangleShape2D" id=1]
extents = Vector2( 112.784, 53.9413 )
[sub_resource type="RectangleShape2D" id=3]
extents = Vector2( 49.9564, 83.1256 )
[node name="Tree" type="KinematicBody2D"]
script = ExtResource( 2 )
[node name="Sprite" type="AnimatedSprite" parent="."]
frames = SubResource( 2 )
[node name="Leaves" type="CollisionShape2D" parent="."]
position = Vector2( 0.629959, -28.6632 )
shape = SubResource( 1 )
[node name="Trunk" type="CollisionShape2D" parent="."]
position = Vector2( -57.0114, 4.03472 )
shape = SubResource( 3 )

View File

@ -9,4 +9,4 @@
position = Vector2( 362.448, 402.091 )
[node name="Tree" parent="." instance=ExtResource( 2 )]
position = Vector2( 118.928, 186.887 )
position = Vector2( 105.083, 177.89 )

View File

@ -1,6 +1,6 @@
extends KinematicBody2D
export var speed = 50
export var speed = 5
# Called when the node enters the scene tree for the first time.
@ -8,7 +8,9 @@ func _ready():
pass # Replace with function body.
func _physics_process(delta):
var input_movement = int(Input.is_action_pressed("right")) - int(Input.is_action_pressed("left"))
self.move_and_slide(Vector2(input_movement * speed, 0), Vector2(0, -1))
if Input.is_action_pressed("right"):
self.move_and_collide(Vector2(speed,0))
$Sprite.flip_h = true
elif Input.is_action_pressed("left"):
$Sprite.flip_h = false
self.move_and_collide(Vector2(-speed,0))

18
scripts/Tree.gd 100644
View File

@ -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")