Added the bunny! WIP. Has issues with turning around

This commit is contained in:
2026-06-21 18:28:15 -06:00
parent a20cfbe748
commit 2b7f22f4ce
21 changed files with 421 additions and 43 deletions
Binary file not shown.

After

Width:  |  Height:  |  Size: 951 B

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ckphhkwwkoel1"
path="res://.godot/imported/BunnyDead-Sheet.png-6dc8995528aa24b42eb30d96307909b6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/Bunny/BunnyDead-Sheet.png"
dest_files=["res://.godot/imported/BunnyDead-Sheet.png-6dc8995528aa24b42eb30d96307909b6.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 675 B

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bmfb06aaharm1"
path="res://.godot/imported/BunnyHurt-Sheet.png-b0c39d4bb0afa12320972037754a9b59.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/Bunny/BunnyHurt-Sheet.png"
dest_files=["res://.godot/imported/BunnyHurt-Sheet.png-b0c39d4bb0afa12320972037754a9b59.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bl55ade1p47rf"
path="res://.godot/imported/BunnyIdle-Sheet.png-83749da5d937db3f230e1bfc081052f6.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/Bunny/BunnyIdle-Sheet.png"
dest_files=["res://.godot/imported/BunnyIdle-Sheet.png-83749da5d937db3f230e1bfc081052f6.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://nr1dxc1p6fe8"
path="res://.godot/imported/BunnyRun-Sheet.png-369c48fd7cea6e925cc3742b9ce8784f.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/images/Bunny/BunnyRun-Sheet.png"
dest_files=["res://.godot/imported/BunnyRun-Sheet.png-369c48fd7cea6e925cc3742b9ce8784f.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://b7lpdtgg0gdgo"
path="res://.godot/imported/death.mp3-8ac1a1a196f2e7145a2f724dfe6ad661.mp3str"
[deps]
source_file="res://assets/sounds/death.mp3"
dest_files=["res://.godot/imported/death.mp3-8ac1a1a196f2e7145a2f724dfe6ad661.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
Binary file not shown.
-24
View File
@@ -1,24 +0,0 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://07pjcmidpc1e"
path="res://.godot/imported/death.wav-75b3b960b42f4ac0e66fdefe9fd48ee1.sample"
[deps]
source_file="res://assets/sounds/death.wav"
dest_files=["res://.godot/imported/death.wav-75b3b960b42f4ac0e66fdefe9fd48ee1.sample"]
[params]
force/8_bit=false
force/mono=false
force/max_rate=false
force/max_rate_hz=44100
edit/trim=false
edit/normalize=false
edit/loop_mode=0
edit/loop_begin=0
edit/loop_end=-1
compress/mode=2
Binary file not shown.
+19
View File
@@ -0,0 +1,19 @@
[remap]
importer="mp3"
type="AudioStreamMP3"
uid="uid://7pkqsi6fv8hb"
path="res://.godot/imported/squish.mp3-5f7c0355334f8f69175ab1b44e280b29.mp3str"
[deps]
source_file="res://assets/sounds/squish.mp3"
dest_files=["res://.godot/imported/squish.mp3-5f7c0355334f8f69175ab1b44e280b29.mp3str"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4
+44
View File
@@ -0,0 +1,44 @@
extends Node2D
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
@onready var wait_timer: Timer = $WaitTimer
@onready var collision_shape_2d: CollisionShape2D = $Area2D/CollisionShape2D
@onready var death_collision_box: CollisionShape2D = $DeathBox/DeathCollisionBox
var direction :float = 1.0
const SPEED = 150
signal player_died
var wait :bool = false
func _process(delta: float) -> void:
if !wait:
position.x += direction * SPEED * delta
func _on_area_2d_body_entered(body: Node2D) -> void:
if body.name == "player":
emit_signal("player_died", body)
else:
wait = true
_death_box_enabled()
animated_sprite_2d.animation = "idle"
animated_sprite_2d.flip_h = !animated_sprite_2d.flip_h
wait_timer.start()
func _on_wait_timer_timeout() -> void:
animated_sprite_2d.animation = "run"
_death_box_disabled()
wait = false
direction *= -1
func _death_box_enabled() -> void:
collision_shape_2d.set_deferred("disabled", true)
death_collision_box.set_deferred("disabled", false)
func _death_box_disabled() -> void:
collision_shape_2d.set_deferred("disabled", false)
death_collision_box.set_deferred("disabled", true)
func _on_death_box_body_entered(body: Node2D) -> void:
print("Dead")
+1
View File
@@ -0,0 +1 @@
uid://br5jkh3x703qw
+144
View File
@@ -0,0 +1,144 @@
[gd_scene format=3 uid="uid://gmne5t7xj3ta"]
[ext_resource type="Script" uid="uid://br5jkh3x703qw" path="res://bunny.gd" id="1_dvrf6"]
[ext_resource type="Texture2D" uid="uid://nr1dxc1p6fe8" path="res://assets/images/Bunny/BunnyRun-Sheet.png" id="1_u834r"]
[ext_resource type="Texture2D" uid="uid://bl55ade1p47rf" path="res://assets/images/Bunny/BunnyIdle-Sheet.png" id="2_e4qck"]
[sub_resource type="AtlasTexture" id="AtlasTexture_5ecvt"]
atlas = ExtResource("2_e4qck")
region = Rect2(0, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_qx6ai"]
atlas = ExtResource("2_e4qck")
region = Rect2(32, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_jsbfh"]
atlas = ExtResource("2_e4qck")
region = Rect2(64, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_g5rs1"]
atlas = ExtResource("2_e4qck")
region = Rect2(96, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_76uj3"]
atlas = ExtResource("2_e4qck")
region = Rect2(128, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_11snv"]
atlas = ExtResource("2_e4qck")
region = Rect2(160, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_km0dj"]
atlas = ExtResource("2_e4qck")
region = Rect2(192, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_6sma1"]
atlas = ExtResource("2_e4qck")
region = Rect2(224, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_dvrf6"]
atlas = ExtResource("1_u834r")
region = Rect2(0, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_e4qck"]
atlas = ExtResource("1_u834r")
region = Rect2(32, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_gs0sc"]
atlas = ExtResource("1_u834r")
region = Rect2(64, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_g7ptr"]
atlas = ExtResource("1_u834r")
region = Rect2(96, 0, 32, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_vonwv"]
atlas = ExtResource("1_u834r")
region = Rect2(128, 0, 32, 32)
[sub_resource type="SpriteFrames" id="SpriteFrames_5ecvt"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_5ecvt")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_qx6ai")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jsbfh")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_g5rs1")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_76uj3")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_11snv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_km0dj")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_6sma1")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_dvrf6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_e4qck")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_gs0sc")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_g7ptr")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_vonwv")
}],
"loop": true,
"name": &"run",
"speed": 12.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_u834r"]
size = Vector2(19, 21)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_e4qck"]
size = Vector2(14, 4)
[node name="Bunny" type="Node2D" unique_id=1276098802]
script = ExtResource("1_dvrf6")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="." unique_id=623860503]
texture_filter = 1
sprite_frames = SubResource("SpriteFrames_5ecvt")
animation = &"idle"
autoplay = "run"
[node name="Area2D" type="Area2D" parent="." unique_id=83756394]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D" unique_id=286806552]
visible = false
position = Vector2(-0.5, -0.5)
shape = SubResource("RectangleShape2D_u834r")
[node name="WaitTimer" type="Timer" parent="." unique_id=618329498]
one_shot = true
[node name="DeathBox" type="Area2D" parent="." unique_id=78599148]
[node name="DeathCollisionBox" type="CollisionShape2D" parent="DeathBox" unique_id=993689400]
position = Vector2(-3, -8)
shape = SubResource("RectangleShape2D_e4qck")
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
[connection signal="timeout" from="WaitTimer" to="." method="_on_wait_timer_timeout"]
[connection signal="body_entered" from="DeathBox" to="." method="_on_death_box_body_entered"]
+6 -2
View File
File diff suppressed because one or more lines are too long
+4 -4
View File
@@ -5,8 +5,8 @@
[ext_resource type="Texture2D" uid="uid://krcywud8ps3s" path="res://assets/images/Pink Man/Idle (32x32).png" id="2_sweqy"] [ext_resource type="Texture2D" uid="uid://krcywud8ps3s" path="res://assets/images/Pink Man/Idle (32x32).png" id="2_sweqy"]
[ext_resource type="Texture2D" uid="uid://ujld3l6fo8p6" path="res://assets/images/Pink Man/Jump (32x32).png" id="3_2hs0m"] [ext_resource type="Texture2D" uid="uid://ujld3l6fo8p6" path="res://assets/images/Pink Man/Jump (32x32).png" id="3_2hs0m"]
[ext_resource type="Texture2D" uid="uid://bq6xnyyhl5od7" path="res://assets/images/Pink Man/Run (32x32).png" id="4_1jxqw"] [ext_resource type="Texture2D" uid="uid://bq6xnyyhl5od7" path="res://assets/images/Pink Man/Run (32x32).png" id="4_1jxqw"]
[ext_resource type="AudioStream" uid="uid://b7lpdtgg0gdgo" path="res://assets/sounds/death.mp3" id="6_1jxqw"]
[ext_resource type="AudioStream" uid="uid://bibfbl3bdtj0t" path="res://assets/sounds/jump.wav" id="6_2hs0m"] [ext_resource type="AudioStream" uid="uid://bibfbl3bdtj0t" path="res://assets/sounds/jump.wav" id="6_2hs0m"]
[ext_resource type="AudioStream" uid="uid://07pjcmidpc1e" path="res://assets/sounds/death.wav" id="7_1jxqw"]
[sub_resource type="AtlasTexture" id="AtlasTexture_dw050"] [sub_resource type="AtlasTexture" id="AtlasTexture_dw050"]
atlas = ExtResource("1_hqtel") atlas = ExtResource("1_hqtel")
@@ -245,7 +245,7 @@ animations = [{
}] }]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sweqy"] [sub_resource type="RectangleShape2D" id="RectangleShape2D_sweqy"]
size = Vector2(13.000001, 23.333332) size = Vector2(13.000001, 21.999998)
[node name="player" type="CharacterBody2D" unique_id=392379192] [node name="player" type="CharacterBody2D" unique_id=392379192]
script = ExtResource("1_sweqy") script = ExtResource("1_sweqy")
@@ -260,14 +260,14 @@ frame = 7
frame_progress = 0.036300987 frame_progress = 0.036300987
[node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1853222578] [node name="CollisionShape2D" type="CollisionShape2D" parent="." unique_id=1853222578]
position = Vector2(0.49999952, 2.666668) position = Vector2(0.49999952, 2.000001)
shape = SubResource("RectangleShape2D_sweqy") shape = SubResource("RectangleShape2D_sweqy")
[node name="JumpSound" type="AudioStreamPlayer2D" parent="." unique_id=1585311637] [node name="JumpSound" type="AudioStreamPlayer2D" parent="." unique_id=1585311637]
stream = ExtResource("6_2hs0m") stream = ExtResource("6_2hs0m")
[node name="DeathSound" type="AudioStreamPlayer2D" parent="." unique_id=340982183] [node name="DeathSound" type="AudioStreamPlayer2D" parent="." unique_id=340982183]
stream = ExtResource("7_1jxqw") stream = ExtResource("6_1jxqw")
[node name="RespawnTimer" type="Timer" parent="." unique_id=1999432688] [node name="RespawnTimer" type="Timer" parent="." unique_id=1999432688]
one_shot = true one_shot = true
+16 -10
View File
@@ -2,34 +2,40 @@ extends Node2D
@onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D @onready var animated_sprite_2d: AnimatedSprite2D = $AnimatedSprite2D
@onready var death_timer: Timer = $DeathTimer @onready var death_timer: Timer = $DeathTimer
@onready var collision_shape_2d: CollisionShape2D = $AnimatedSprite2D/Area2D/CollisionShape2D @onready var front: CollisionShape2D = $AnimatedSprite2D/Area2D/Front
@onready var back: CollisionShape2D = $AnimatedSprite2D/Area2D/Back
@onready var squish: AudioStreamPlayer2D = $Squish
signal player_died signal player_died
const SPEED :int = 50 const SPEED :int = 50
var direction :float = -1.0 var direction :float = -1.0
var alive :bool = true
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame. # Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void: func _process(delta: float) -> void:
if !alive:
return
position.x += direction * SPEED * delta position.x += direction * SPEED * delta
func _on_area_2d_body_entered_for_death(body: Node2D) -> void: func _on_area_2d_body_entered_for_death(body: Node2D) -> void:
if body.name == "player": if body.name == "player":
animated_sprite_2d.animation = "dying" animated_sprite_2d.animation = "dying"
queue_free() squish.play()
death_timer.start() death_timer.start()
front.set_deferred("disabled", true)
back.set_deferred("disabled", true)
alive = false
position.x = position.x
func _on_body_entered(body: Node2D) -> void: func _on_body_entered(body: Node2D) -> void:
if body.name == "player": if body.name == "player":
emit_signal("player_died", body) emit_signal("player_died", body)
direction *= -1 else:
animated_sprite_2d.flip_h = !animated_sprite_2d.flip_h direction *= -1
animated_sprite_2d.flip_h = !animated_sprite_2d.flip_h
func _on_death_timer_timeout() -> void: func _on_death_timer_timeout() -> void:
print("Timer finished") queue_free()
+7 -2
View File
@@ -3,6 +3,7 @@
[ext_resource type="Script" uid="uid://hydqcpmmn0pu" path="res://snail.gd" id="1_insh8"] [ext_resource type="Script" uid="uid://hydqcpmmn0pu" path="res://snail.gd" id="1_insh8"]
[ext_resource type="Texture2D" uid="uid://6gtaxba6kn6" path="res://assets/images/Snail/Hit (38x24).png" id="1_kwcx3"] [ext_resource type="Texture2D" uid="uid://6gtaxba6kn6" path="res://assets/images/Snail/Hit (38x24).png" id="1_kwcx3"]
[ext_resource type="Texture2D" uid="uid://cix1l1ksp8og6" path="res://assets/images/Snail/Walk (38x24).png" id="2_insh8"] [ext_resource type="Texture2D" uid="uid://cix1l1ksp8og6" path="res://assets/images/Snail/Walk (38x24).png" id="2_insh8"]
[ext_resource type="AudioStream" uid="uid://7pkqsi6fv8hb" path="res://assets/sounds/squish.mp3" id="4_4w31b"]
[sub_resource type="AtlasTexture" id="AtlasTexture_4w31b"] [sub_resource type="AtlasTexture" id="AtlasTexture_4w31b"]
atlas = ExtResource("1_kwcx3") atlas = ExtResource("1_kwcx3")
@@ -142,11 +143,11 @@ frame_progress = 0.12121709
[node name="Area2D" type="Area2D" parent="AnimatedSprite2D" unique_id=13797364] [node name="Area2D" type="Area2D" parent="AnimatedSprite2D" unique_id=13797364]
position = Vector2(2, 0) position = Vector2(2, 0)
[node name="CollisionShape2D" type="CollisionShape2D" parent="AnimatedSprite2D/Area2D" unique_id=1763263041] [node name="Front" type="CollisionShape2D" parent="AnimatedSprite2D/Area2D" unique_id=1763263041]
position = Vector2(-17, 5) position = Vector2(-17, 5)
shape = SubResource("RectangleShape2D_r7se8") shape = SubResource("RectangleShape2D_r7se8")
[node name="CollisionShape2D2" type="CollisionShape2D" parent="AnimatedSprite2D/Area2D" unique_id=1521992116] [node name="Back" type="CollisionShape2D" parent="AnimatedSprite2D/Area2D" unique_id=1521992116]
position = Vector2(15, 5) position = Vector2(15, 5)
shape = SubResource("RectangleShape2D_r7se8") shape = SubResource("RectangleShape2D_r7se8")
@@ -159,6 +160,10 @@ one_shot = true
position = Vector2(-1.5, -4) position = Vector2(-1.5, -4)
shape = SubResource("RectangleShape2D_insh8") shape = SubResource("RectangleShape2D_insh8")
[node name="Squish" type="AudioStreamPlayer2D" parent="." unique_id=1323643234]
stream = ExtResource("4_4w31b")
volume_db = 1.0
[connection signal="body_entered" from="AnimatedSprite2D/Area2D" to="." method="_on_body_entered"] [connection signal="body_entered" from="AnimatedSprite2D/Area2D" to="." method="_on_body_entered"]
[connection signal="timeout" from="DeathTimer" to="." method="_on_death_timer_timeout"] [connection signal="timeout" from="DeathTimer" to="." method="_on_death_timer_timeout"]
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered_for_death"] [connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered_for_death"]