From d725e1a0cfd2eb31e2ed6d6038c04f702b567990 Mon Sep 17 00:00:00 2001 From: Tabby <41929769+tabby-cat-nya@users.noreply.github.com> Date: Sat, 17 May 2025 14:41:41 +1000 Subject: [PATCH] lunch timeee --- game_logic.gd | 2 +- game_manager.gd | 4 ++ games/platformer/platformer.gd | 5 ++ games/platformer/platformer.tscn | 81 ++++++++++++++++++++++++++++--- games/platformer/player.gd | 14 ++++++ sprites/neko.png | Bin 0 -> 4412 bytes sprites/neko.png.import | 34 +++++++++++++ 7 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 sprites/neko.png create mode 100644 sprites/neko.png.import diff --git a/game_logic.gd b/game_logic.gd index 8ae9208..870d0cd 100644 --- a/game_logic.gd +++ b/game_logic.gd @@ -111,7 +111,7 @@ func rec_channel_lose(): func game_over_gg(): zoom_in() - game_over.emit() + gameplay = false main_channel.end_channel() for channel in outer_channels: diff --git a/game_manager.gd b/game_manager.gd index 1a3fdb6..d8b1e42 100644 --- a/game_manager.gd +++ b/game_manager.gd @@ -14,6 +14,7 @@ signal update_data(score : int, lives : int) signal skip_intro signal start_platformer signal end_platformer +signal game_over @export var broken_tv_remote : Texture var are_we_skipping_intro : bool = false @@ -53,3 +54,6 @@ func actually_gaming(): func send_update_data(score : int, lives: int): update_data.emit(score, lives) + +func send_game_over(): + game_over.emit() diff --git a/games/platformer/platformer.gd b/games/platformer/platformer.gd index f817321..17be07f 100644 --- a/games/platformer/platformer.gd +++ b/games/platformer/platformer.gd @@ -31,6 +31,7 @@ func _ready() -> void: GameManager.update_data.connect(update_ui) GameManager.start_platformer.connect(start_game) GameManager.end_platformer.connect(end_game) + GameManager.game_over.connect(display_game_over) pass # Replace with function body. @@ -83,3 +84,7 @@ func _on_timer_timeout() -> void: end_game() #if i havent died yet, then win + +func display_game_over(): + stage = GameStage.None + #game_active = true diff --git a/games/platformer/platformer.tscn b/games/platformer/platformer.tscn index b049938..b04c5a8 100644 --- a/games/platformer/platformer.tscn +++ b/games/platformer/platformer.tscn @@ -1,11 +1,11 @@ -[gd_scene load_steps=39 format=4 uid="uid://ckbyiwy0dxbsd"] +[gd_scene load_steps=47 format=4 uid="uid://ckbyiwy0dxbsd"] [ext_resource type="Script" uid="uid://dqyddqx8xm0gw" path="res://games/platformer/player.gd" id="1_1wj3w"] [ext_resource type="Script" uid="uid://bs4keltwfbrrn" path="res://games/platformer/platformer.gd" id="1_mauky"] -[ext_resource type="Texture2D" uid="uid://diilj7xuttpqu" path="res://icon.svg" id="1_oyf6i"] [ext_resource type="Texture2D" uid="uid://baf30tscdkl0i" path="res://sprites/tv_remote.png" id="2_7eu3u"] [ext_resource type="Texture2D" uid="uid://g5arxk4po7kw" path="res://sprites/platformer_lab_tile.png" id="3_84mot"] [ext_resource type="Texture2D" uid="uid://d1mo5ecyjgngw" path="res://sprites/platformer_stone_tile.png" id="4_86tx6"] +[ext_resource type="Texture2D" uid="uid://t4vhpibk2yb5" path="res://sprites/neko.png" id="4_g0mja"] [ext_resource type="PackedScene" uid="uid://q3wdnawp7n63" path="res://games/platformer/lab_platform.tscn" id="4_w58m1"] [ext_resource type="Script" uid="uid://43jxroyergh0" path="res://games/platformer/platformerCam.gd" id="5_x2rtd"] [ext_resource type="Texture2D" uid="uid://dyjxtuapxfiip" path="res://sprites/box.png" id="6_02uuf"] @@ -32,6 +32,73 @@ width = 300 height = 180 fill_from = Vector2(1, 1) +[sub_resource type="AtlasTexture" id="AtlasTexture_4fc0x"] +atlas = ExtResource("4_g0mja") +region = Rect2(16, 16, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_1i68h"] +atlas = ExtResource("4_g0mja") +region = Rect2(32, 16, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_ftlpv"] +atlas = ExtResource("4_g0mja") +region = Rect2(16, 48, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_7hkwn"] +atlas = ExtResource("4_g0mja") +region = Rect2(16, 32, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_pj7n8"] +atlas = ExtResource("4_g0mja") +region = Rect2(32, 32, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_3wy10"] +atlas = ExtResource("4_g0mja") +region = Rect2(48, 32, 16, 16) + +[sub_resource type="AtlasTexture" id="AtlasTexture_we8k4"] +atlas = ExtResource("4_g0mja") +region = Rect2(64, 32, 16, 16) + +[sub_resource type="SpriteFrames" id="SpriteFrames_i6xil"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_4fc0x") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1i68h") +}], +"loop": true, +"name": &"idle", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_ftlpv") +}], +"loop": true, +"name": &"jump", +"speed": 5.0 +}, { +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_7hkwn") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_pj7n8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_3wy10") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_we8k4") +}], +"loop": true, +"name": &"run", +"speed": 5.0 +}] + [sub_resource type="RectangleShape2D" id="RectangleShape2D_oyf6i"] size = Vector2(32, 32) @@ -219,14 +286,16 @@ grow_vertical = 2 scale = Vector2(2, 2) texture = SubResource("GradientTexture2D_84mot") -[node name="Player" type="CharacterBody2D" parent="."] +[node name="Player" type="CharacterBody2D" parent="." node_paths=PackedStringArray("player_sprite")] position = Vector2(-1552, -504) script = ExtResource("1_1wj3w") remote_sprite = ExtResource("2_7eu3u") +player_sprite = NodePath("Sprite2D") -[node name="Sprite2D" type="Sprite2D" parent="Player"] -scale = Vector2(0.25, 0.25) -texture = ExtResource("1_oyf6i") +[node name="Sprite2D" type="AnimatedSprite2D" parent="Player"] +scale = Vector2(2, 2) +sprite_frames = SubResource("SpriteFrames_i6xil") +animation = &"jump" [node name="CollisionShape2D" type="CollisionShape2D" parent="Player"] shape = SubResource("RectangleShape2D_oyf6i") diff --git a/games/platformer/player.gd b/games/platformer/player.gd index 77f1fe2..5082629 100644 --- a/games/platformer/player.gd +++ b/games/platformer/player.gd @@ -5,6 +5,7 @@ signal remote_get @export var SPEED = 200.0 @export var JUMP_VELOCITY = -450.0 @export var remote_sprite : Texture +@export var player_sprite : AnimatedSprite2D var controls_enabled : bool = true func _ready() -> void: @@ -15,6 +16,7 @@ func _process(delta: float) -> void: # Add the gravity. if not is_on_floor(): velocity += get_gravity() * delta + player_sprite.play("jump") if(controls_enabled): @@ -29,10 +31,22 @@ func _process(delta: float) -> void: velocity.x = direction * SPEED else: velocity.x = move_toward(velocity.x, 0, SPEED) + + if(direction < 0): + player_sprite.flip_h = true + elif(direction>0): + player_sprite.flip_h = false + + if(direction != 0 and is_on_floor()): + player_sprite.play("run") + elif(is_on_floor()): + player_sprite.play("idle") else: velocity.x = move_toward(velocity.x, 0, SPEED) move_and_slide() + + func _on_hitbox_area_entered(area: Area2D) -> void: diff --git a/sprites/neko.png b/sprites/neko.png new file mode 100644 index 0000000000000000000000000000000000000000..444effd8649093ca3c50ef3971cfc24e504591b9 GIT binary patch literal 4412 zcmV-C5yS3@P)004&%004{+008|`004nN004b?008NW002DY000@xb3BE2000Uv zX+uL$Nkc;*P;zf(X>4Tx07%E3mUmQC*A|D*y?1({%`gH|hTglt0MdJtUPWP;8DJ;_ z4l^{dA)*2iMMRn+NKnLp(NH8-M6nPQRImpm2q-ZaMN}+rM%Ih2ti1Q~^84egZ|$@9 zx%=$B&srA%lBX}1mj+7#kjfMAgFKw+5s^`J>;QlP9$S?PR%=$HTzo3l9?ED;xoI3-JvF1F8#m>QQXW*8-A zz9>Nv%ZWK*kqtikEV84R*{M9Xh{ZXlvs2k(?iKO2Od&_ah_8qXGr62B5#JKAMv5?% zE8;ie*i;TP0{|3BY!`4?i6S-;F^L}%f`(o2L0Dz>ZZynda zx(`h}FNp#{x{a}MR#uh~m%}m=7xWMPPlvyuufAs_KJJh5&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