Merge pull request 'Book_Pushables' (#40) from Book_Pushables into dev

Reviewed-on: https://code.booklordofthe.dev///Booklordofthedings/GMTK-2024/pulls/40
This commit is contained in:
Booklordofthedings 2024-08-18 12:15:05 +02:00
commit 34f19f4eb7
8 changed files with 52 additions and 3 deletions

View file

@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=4 uid="uid://ctc0arg3efa5k"] [gd_scene load_steps=12 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"]
@ -6,7 +6,11 @@
[ext_resource type="Texture2D" uid="uid://bki6ucvk6bjwk" 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" uid="uid://d0gpnqknarkg7" 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" uid="uid://cpa66thuxma15" path="res://objects/MirrorOrb.tscn" id="7_dyi0e"] [ext_resource type="PackedScene" uid="uid://cpa66thuxma15" path="res://objects/MirrorOrb.tscn" id="7_dyi0e"]
<<<<<<< HEAD
[ext_resource type="PackedScene" uid="uid://d17jpcgayfg6i" path="res://objects/BoxPushable_1.tscn" id="8_o0q03"]
=======
[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"]
>>>>>>> dev
[sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_e817v"] [sub_resource type="TileSetAtlasSource" id="TileSetAtlasSource_e817v"]
texture = ExtResource("2_wqskp") texture = ExtResource("2_wqskp")
@ -166,6 +170,11 @@ position = Vector2(582, -317)
[node name="MirrorOrb" parent="." index="8" instance=ExtResource("7_dyi0e")] [node name="MirrorOrb" parent="." index="8" instance=ExtResource("7_dyi0e")]
position = Vector2(-431, -212) position = Vector2(-431, -212)
<<<<<<< HEAD
[node name="BoxPushable1" parent="." index="13" instance=ExtResource("8_o0q03")]
position = Vector2(-228, 320)
=======
[node name="Block" parent="." index="9" instance=ExtResource("8_ec71m")] [node name="Block" parent="." index="9" instance=ExtResource("8_ec71m")]
position = Vector2(476, 253) position = Vector2(476, 253)
collision_layer = 1 collision_layer = 1
>>>>>>> dev

View file

@ -0,0 +1,18 @@
[gd_scene load_steps=4 format=3 uid="uid://d17jpcgayfg6i"]
[ext_resource type="Texture2D" uid="uid://buqgl7x10et1f" path="res://temp_assets/img.png" id="1_ocrks"]
[ext_resource type="Script" path="res://scripts/pushable.gd" id="1_tf1fy"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_legx4"]
size = Vector2(34, 32)
[node name="BoxPushable1" type="CharacterBody2D"]
collision_layer = 16
collision_mask = 5
script = ExtResource("1_tf1fy")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_legx4")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_ocrks")

View file

@ -9,7 +9,7 @@ height = 32.0
[node name="EnemyMover" type="CharacterBody2D"] [node name="EnemyMover" type="CharacterBody2D"]
collision_layer = 2 collision_layer = 2
collision_mask = 7 collision_mask = 23
script = ExtResource("1_7kapi") script = ExtResource("1_7kapi")
speed = 75 speed = 75

View file

@ -12,7 +12,7 @@ radius = 12.0
[node name="Player" type="CharacterBody2D"] [node name="Player" type="CharacterBody2D"]
collision_layer = 4 collision_layer = 4
collision_mask = 3 collision_mask = 19
script = ExtResource("1_a6lhy") script = ExtResource("1_a6lhy")
jump_strength = 600 jump_strength = 600

View file

@ -56,7 +56,11 @@ clickR={
2d_physics/layer_2="Enemies" 2d_physics/layer_2="Enemies"
2d_physics/layer_3="Player" 2d_physics/layer_3="Player"
2d_physics/layer_4="Goal" 2d_physics/layer_4="Goal"
<<<<<<< HEAD
2d_physics/layer_5="Pushable"
=======
2d_physics/layer_5="Interactions" 2d_physics/layer_5="Interactions"
>>>>>>> dev
[rendering] [rendering]

View file

@ -54,6 +54,12 @@ func _physics_process(delta):
get_input(delta) get_input(delta)
velocity.y += gravity velocity.y += gravity
move_and_slide() 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 Box
if box and velocity.y >= 0:
box.velocity.x = velocity.x*0.8
# print(jump_count) # Uncomment for debugging # print(jump_count) # Uncomment for debugging
func Jump(): func Jump():

View file

@ -0,0 +1,7 @@
extends CharacterBody2D
class_name Box;
func _physics_process(delta: float) -> void:
velocity.y += 50
velocity.x = velocity.x * 0.8
move_and_slide()

View file

@ -4,11 +4,16 @@ extends Node
var current_selected = "none"; var current_selected = "none";
<<<<<<< HEAD
func _process(delta: float) -> void:
if Input.is_action_just_pressed("click"):
=======
@export var scale_duration: float = 0.5 @export var scale_duration: float = 0.5
var target_scale: Vector2 = Vector2(1, 1) var target_scale: Vector2 = Vector2(1, 1)
func _unhandled_input(event: InputEvent) -> void: func _unhandled_input(event: InputEvent) -> void:
if event.is_action_pressed("click"): if event.is_action_pressed("click"):
>>>>>>> dev
if current_selected == "scale_up": if current_selected == "scale_up":
scale_up() scale_up()
elif current_selected == "scale_down": elif current_selected == "scale_down":