scaling objects or the player works
This commit is contained in:
parent
2c08e2d99c
commit
138d4c2cfb
9 changed files with 95 additions and 27 deletions
File diff suppressed because one or more lines are too long
|
@ -1,9 +1,9 @@
|
||||||
[gd_scene load_steps=7 format=3 uid="uid://t83eid7pf4iv"]
|
[gd_scene load_steps=7 format=3 uid="uid://t83eid7pf4iv"]
|
||||||
|
|
||||||
[ext_resource type="Texture2D" uid="uid://dd5ufa00fdgk2" path="res://textures/File-Icon.png" id="1_2sfn6"]
|
[ext_resource type="Texture2D" uid="uid://yg2u8vwwbpv1" path="res://textures/File-Icon.png" id="1_2sfn6"]
|
||||||
[ext_resource type="Texture2D" uid="uid://cf17aig8u3ue3" path="res://textures/File-Icon-Closed.png" id="2_6ev1f"]
|
[ext_resource type="Texture2D" uid="uid://bc2ictes4mln1" path="res://textures/File-Icon-Closed.png" id="2_6ev1f"]
|
||||||
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="3_732s0"]
|
[ext_resource type="FontFile" uid="uid://d3pbvdemdbxes" path="res://CommodoreSixtyFour.ttf" id="3_732s0"]
|
||||||
[ext_resource type="Texture2D" uid="uid://bihp6n2kusbql" path="res://textures/File-Icon-Sheet.png" id="3_bbfoq"]
|
[ext_resource type="Texture2D" uid="uid://cp2ybylvgmek4" path="res://textures/File-Icon-Sheet.png" id="3_bbfoq"]
|
||||||
[ext_resource type="Script" path="res://scripts/level_menu_level_button.gd" id="3_e83yn"]
|
[ext_resource type="Script" path="res://scripts/level_menu_level_button.gd" id="3_e83yn"]
|
||||||
|
|
||||||
[sub_resource type="AtlasTexture" id="AtlasTexture_u313o"]
|
[sub_resource type="AtlasTexture" id="AtlasTexture_u313o"]
|
||||||
|
|
21
gmtk_2024/objects/ResizableBlock.tscn
Normal file
21
gmtk_2024/objects/ResizableBlock.tscn
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
[gd_scene load_steps=4 format=3 uid="uid://br6fngf5208j0"]
|
||||||
|
|
||||||
|
[ext_resource type="Texture2D" uid="uid://bplkveclkwuk" path="res://textures/block-big.png" id="1_ejp7j"]
|
||||||
|
[ext_resource type="Script" path="res://scripts/resizable_block.gd" id="1_j40bu"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_h0307"]
|
||||||
|
radius = 35.0143
|
||||||
|
|
||||||
|
[node name="Block" type="StaticBody2D"]
|
||||||
|
collision_layer = 17
|
||||||
|
collision_mask = 22
|
||||||
|
input_pickable = true
|
||||||
|
script = ExtResource("1_j40bu")
|
||||||
|
|
||||||
|
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||||
|
texture = ExtResource("1_ejp7j")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_h0307")
|
||||||
|
|
||||||
|
[connection signal="input_event" from="." to="." method="_on_input_event"]
|
|
@ -44,6 +44,11 @@ click={
|
||||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
clickR={
|
||||||
|
"deadzone": 0.5,
|
||||||
|
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
@ -51,6 +56,7 @@ click={
|
||||||
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"
|
||||||
|
2d_physics/layer_5="Interactions"
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
||||||
|
|
|
@ -64,3 +64,7 @@ func Jump():
|
||||||
|
|
||||||
func _on_hurtbox_body_entered(body: Node2D) -> void:
|
func _on_hurtbox_body_entered(body: Node2D) -> void:
|
||||||
get_tree().reload_current_scene()
|
get_tree().reload_current_scene()
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_2d_body_entered(body):
|
||||||
|
print("Body entered")
|
||||||
|
|
24
gmtk_2024/scripts/resizable_block.gd
Normal file
24
gmtk_2024/scripts/resizable_block.gd
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
extends StaticBody2D
|
||||||
|
|
||||||
|
@export var scale_up_target: Vector2 = Vector2(3.0, 3.0)
|
||||||
|
@export var scale_down_target: Vector2 = Vector2(0.5, 0.5)
|
||||||
|
@export var scale_duration: float = 0.5
|
||||||
|
|
||||||
|
|
||||||
|
func scale_up():
|
||||||
|
var tween = create_tween()
|
||||||
|
tween.tween_property(self, "scale", scale_up_target, scale_duration)
|
||||||
|
# TODO: scale the player
|
||||||
|
|
||||||
|
func scale_down():
|
||||||
|
var tween = create_tween()
|
||||||
|
tween.tween_property(self, "scale", scale_down_target, scale_duration)
|
||||||
|
# TODO: scale the player
|
||||||
|
|
||||||
|
func _on_input_event(viewport, event, shape_idx):
|
||||||
|
print("works")
|
||||||
|
if event is InputEventMouseButton and event.pressed:
|
||||||
|
if Input.is_action_just_pressed("click"):
|
||||||
|
scale_up()
|
||||||
|
elif Input.is_action_just_pressed("clickR"):
|
||||||
|
scale_down()
|
|
@ -4,6 +4,9 @@ extends Node
|
||||||
|
|
||||||
var current_selected = "none";
|
var current_selected = "none";
|
||||||
|
|
||||||
|
@export var scale_duration: float = 0.5
|
||||||
|
var target_scale: Vector2 = Vector2(1, 1)
|
||||||
|
|
||||||
|
|
||||||
func _process(delta: float) -> void:
|
func _process(delta: float) -> void:
|
||||||
if Input.is_action_just_pressed("click"):
|
if Input.is_action_just_pressed("click"):
|
||||||
|
@ -25,10 +28,18 @@ func select_mirror():
|
||||||
current_selected = "mirror"
|
current_selected = "mirror"
|
||||||
|
|
||||||
func scale_up():
|
func scale_up():
|
||||||
pass #Hir hochscalieren einbauen
|
if player:
|
||||||
|
target_scale = Vector2(3.0, 3.0)
|
||||||
|
start_scaling()
|
||||||
|
|
||||||
func scale_down():
|
func scale_down():
|
||||||
pass #Hir runterscalieren einbauen
|
if player:
|
||||||
|
target_scale = Vector2(0.5, 0.5)
|
||||||
|
start_scaling()
|
||||||
|
|
||||||
|
func start_scaling():
|
||||||
|
var tween = create_tween()
|
||||||
|
tween.tween_property(player, "scale", target_scale, scale_duration)
|
||||||
|
|
||||||
func mirror():
|
func mirror():
|
||||||
pass #Hir mirror einbauen einbauen
|
pass #Hir mirror einbauen einbauen
|
||||||
|
|
BIN
gmtk_2024/textures/block-big.png
Normal file
BIN
gmtk_2024/textures/block-big.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 410 B |
BIN
gmtk_2024/textures/block-small.png
Normal file
BIN
gmtk_2024/textures/block-small.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 338 B |
Loading…
Add table
Reference in a new issue