added breakable blocks
This commit is contained in:
parent
886c7a7233
commit
1c540be7c3
3 changed files with 44 additions and 6 deletions
|
@ -1,14 +1,14 @@
|
||||||
[gd_scene load_steps=12 format=4 uid="uid://ctc0arg3efa5k"]
|
[gd_scene load_steps=13 format=4 uid="uid://ctc0arg3efa5k"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://ba6afuig8bqrg" path="res://levels/LevelBase.tscn" id="1_87xn7"]
|
[ext_resource type="PackedScene" uid="uid://ba6afuig8bqrg" path="res://levels/LevelBase.tscn" id="1_87xn7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c3m4os8kteaix" path="res://textures/level01-spritesheet.png" id="2_wqskp"]
|
[ext_resource type="Texture2D" uid="uid://c3m4os8kteaix" path="res://textures/level01-spritesheet.png" id="2_wqskp"]
|
||||||
[ext_resource type="Shader" path="res://shaders/scrolling.gdshader" id="4_0x2h7"]
|
[ext_resource type="Shader" path="res://shaders/scrolling.gdshader" id="4_0x2h7"]
|
||||||
[ext_resource type="Texture2D" uid="uid://c61y0181w3sq2" path="res://textures/Level 01.png" id="5_4p03u"]
|
[ext_resource type="Texture2D" uid="uid://bki6ucvk6bjwk" path="res://textures/Level 01.png" id="5_4p03u"]
|
||||||
[ext_resource type="PackedScene" path="res://objects/Goal.tscn" id="6_xhax5"]
|
[ext_resource type="PackedScene" uid="uid://d0gpnqknarkg7" path="res://objects/Goal.tscn" id="6_xhax5"]
|
||||||
[ext_resource type="PackedScene" path="res://objects/MirrorOrb.tscn" id="7_dyi0e"]
|
[ext_resource type="PackedScene" uid="uid://cpa66thuxma15" path="res://objects/MirrorOrb.tscn" id="7_dyi0e"]
|
||||||
[ext_resource type="PackedScene" uid="uid://vtwswrkfkgas" path="res://objects/EnemyMover.tscn" id="8_16072"]
|
|
||||||
[ext_resource type="PackedScene" uid="uid://br6fngf5208j0" path="res://objects/ResizableBlock.tscn" id="8_ec71m"]
|
[ext_resource type="PackedScene" uid="uid://br6fngf5208j0" path="res://objects/ResizableBlock.tscn" id="8_ec71m"]
|
||||||
[ext_resource type="PackedScene" uid="uid://d17jpcgayfg6i" path="res://objects/BoxPushable_1.tscn" id="8_urw3p"]
|
[ext_resource type="PackedScene" uid="uid://d17jpcgayfg6i" path="res://objects/BoxPushable_1.tscn" id="8_urw3p"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bnvyaxh2kotd3" path="res://objects/BreakableBlock.tscn" id="9_m0qjy"]
|
||||||
|
|
||||||
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_e817v"]
|
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_e817v"]
|
||||||
texture = ExtResource("2_wqskp")
|
texture = ExtResource("2_wqskp")
|
||||||
|
@ -125,7 +125,7 @@ sources/0 = SubResource("TileSetAtlasSource_e817v")
|
||||||
shader = ExtResource("4_0x2h7")
|
shader = ExtResource("4_0x2h7")
|
||||||
shader_parameter/scroll_speed = 0.02
|
shader_parameter/scroll_speed = 0.02
|
||||||
|
|
||||||
[node name="LevelBase" instance=ExtResource("1_87xn7")]
|
[node name="LevelBase2" instance=ExtResource("1_87xn7")]
|
||||||
|
|
||||||
[node name="Player" parent="." index="0"]
|
[node name="Player" parent="." index="0"]
|
||||||
position = Vector2(-542, 331)
|
position = Vector2(-542, 331)
|
||||||
|
@ -177,3 +177,9 @@ ui_actions = NodePath("../UILayer/UI")
|
||||||
|
|
||||||
[node name="BoxPushable1" parent="." index="11" instance=ExtResource("8_urw3p")]
|
[node name="BoxPushable1" parent="." index="11" instance=ExtResource("8_urw3p")]
|
||||||
position = Vector2(-84, 326)
|
position = Vector2(-84, 326)
|
||||||
|
|
||||||
|
[node name="BreakableBlock" parent="." index="12" instance=ExtResource("9_m0qjy")]
|
||||||
|
position = Vector2(271, 210)
|
||||||
|
|
||||||
|
[node name="BreakableBlock2" parent="." index="13" instance=ExtResource("9_m0qjy")]
|
||||||
|
position = Vector2(240, 210)
|
||||||
|
|
18
gmtk_2024/objects/BreakableBlock.tscn
Normal file
18
gmtk_2024/objects/BreakableBlock.tscn
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://bnvyaxh2kotd3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://scripts/crumble.gd" id="1_5jikw"]
|
||||||
|
[ext_resource type="Texture2D" uid="uid://buqgl7x10et1f" path="res://temp_assets/img.png" id="1_d52wv"]
|
||||||
|
|
||||||
|
[sub_resource type="RectangleShape2D" id="RectangleShape2D_246ea"]
|
||||||
|
size = Vector2(31, 31)
|
||||||
|
|
||||||
|
[node name="BreakableBlock" type="CharacterBody2D"]
|
||||||
|
collision_mask = 22
|
||||||
|
script = ExtResource("1_5jikw")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_d52wv")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(-0.5, -0.5)
|
||||||
|
shape = SubResource("RectangleShape2D_246ea")
|
14
gmtk_2024/scripts/crumble.gd
Normal file
14
gmtk_2024/scripts/crumble.gd
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
extends CharacterBody2D
|
||||||
|
|
||||||
|
|
||||||
|
func _physics_process(delta: float) -> void:
|
||||||
|
move_and_slide()
|
||||||
|
if(get_slide_collision_count() > 0):
|
||||||
|
for i in get_slide_collision_count():
|
||||||
|
var box = get_slide_collision(i).get_collider() as Node2D
|
||||||
|
if box.scale.x == 2:
|
||||||
|
var timer = Timer.new()
|
||||||
|
self.add_child(timer)
|
||||||
|
timer.connect("timeout", queue_free)
|
||||||
|
timer.set_wait_time(1)
|
||||||
|
timer.start()
|
Loading…
Add table
Reference in a new issue