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 0000000..444effd Binary files /dev/null and b/sprites/neko.png differ diff --git a/sprites/neko.png.import b/sprites/neko.png.import new file mode 100644 index 0000000..1d69bf6 --- /dev/null +++ b/sprites/neko.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://t4vhpibk2yb5" +path="res://.godot/imported/neko.png-4a85987a40e9db1331614a9db944720a.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://sprites/neko.png" +dest_files=["res://.godot/imported/neko.png-4a85987a40e9db1331614a9db944720a.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +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/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