Skip to content

Commit

Permalink
add jump n run, increase spike speed, zoom camera, add goal
Browse files Browse the repository at this point in the history
  • Loading branch information
Firsttryy committed Nov 5, 2023
1 parent 0763cad commit 4dab4fa
Show file tree
Hide file tree
Showing 8 changed files with 336 additions and 22 deletions.
4 changes: 4 additions & 0 deletions Camera2D.gd
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,7 @@ func restore_camera_view():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

func increase_zoom(value = 0.1):
zoom += zoom * value
position += Vector2(-60.0, 60.0)
5 changes: 5 additions & 0 deletions SpikeRun.gd
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,8 @@ func _on_clock_behavior_trap_trigger_elapsed():
$SpikeWallMap/AudioStreamPlayer2DSpikes.play()
$Torches/TileMap2.turn_on_lights()
$SpikeWallMap/Camera2D.restore_camera_view()


func _on_area_2d_11_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
if body.is_in_group("player"):
set_spikes_enabled(false)
295 changes: 292 additions & 3 deletions SpikeRun.tscn

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions SpikeWallMap.gd
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,6 @@ func _ready():
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

func increase_zoom():
$Camera2D.increase_zoom()
23 changes: 20 additions & 3 deletions addons/pronto/behaviors/MoveBehavior.gd
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,16 @@ func move_down():
func move_down_a_bit():
if done == false:
move_direction(Vector2(0.0,0.02))


var spike_speed = 0.35

func move_right_a_bit():
move_direction(Vector2(0.35,0.0))

move_direction(Vector2(spike_speed,0.0))

func increase_spike_speed(value = 0.04):
spike_speed += value
pass

func set_done():
done = true

Expand Down Expand Up @@ -178,3 +184,14 @@ func _get_configuration_warnings():

func lines():
return super.lines() + ([Lines.DashedLine.new(self, get_parent(), func (f): return "moves", "moves")])

func _on_area_2d_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
if body.is_in_group("player"):
$"../../Alert".play()
increase_spike_speed()
$"../Camera2D".increase_zoom()

func _on_first_area_2d_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
if body.is_in_group("player"):
$"../../Alert".play()
increase_spike_speed(0.075)
16 changes: 8 additions & 8 deletions prototypes/game-test/game-test.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -1023,7 +1023,7 @@ deferred = false
enabled = true
[sub_resource type="RectangleShape2D" id="RectangleShape2D_iyh7h"]
size = Vector2(4543.5, 26)
size = Vector2(15921.5, 26)
[sub_resource type="Image" id="Image_7laod"]
data = {
Expand Down Expand Up @@ -1342,7 +1342,7 @@ height = 54.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_1kv50"]
size = Vector2(99, 554)
[sub_resource type="GDScript" id="GDScript_xiqiq"]
[sub_resource type="GDScript" id="GDScript_2cw0g"]
script/source = "@tool
#thumb(\"Timer\")
extends Behavior
Expand Down Expand Up @@ -1373,7 +1373,7 @@ var _trigger_count := 0

## How often the signal [signal ClockBehavor.elapsed] will be emitted.
## A value of [code]-1[/code] means no limit.
@export var cycle_count : int = -1
@export var cycle_count : int = 1

## Timer duration in seconds
@export var duration_seconds: float = 1.0:
Expand Down Expand Up @@ -1427,7 +1427,6 @@ var _timer: Timer:

func reset_and_start():
self.paused = false
_trigger_count = 0
_timer.start(duration_seconds)

func _process(delta):
Expand Down Expand Up @@ -1485,7 +1484,7 @@ layer_0/tile_data = PackedInt32Array(589829, 327680, 5, 589830, 327680, 5, 58983
[node name="Player" type="CharacterBody2D" parent="jumpnrun_template" groups=["player"]]
light_mask = 2
position = Vector2(722, 525)
position = Vector2(3759, 554)
[node name="PlaceholderBehavior" type="Node2D" parent="jumpnrun_template/Player"]
script = ExtResource("3_c0q12")
Expand Down Expand Up @@ -1707,7 +1706,7 @@ position = Vector2(389, 786)
metadata/pronto_connections = [SubResource("Resource_3wwl4")]
[node name="CollisionShape2D" type="CollisionShape2D" parent="jumpnrun_template/BottomKillZone" groups=["oob"]]
position = Vector2(1184.25, -65)
position = Vector2(6873.25, -65)
shape = SubResource("RectangleShape2D_iyh7h")
debug_color = Color(0, 0.6, 0.701961, 0.419608)
Expand Down Expand Up @@ -1960,8 +1959,9 @@ script = ExtResource("33_ltmpf")
[node name="ClockBehaviorTrapTrigger" type="Node2D" parent="."]
position = Vector2(5081, -102)
script = SubResource("GDScript_xiqiq")
duration_seconds = 3.0
script = SubResource("GDScript_2cw0g")
cycle_count = -1
duration_seconds = 2.0
paused = true
trigger_interval_in_seconds = 1.0
metadata/pronto_connections = []
Expand Down
2 changes: 1 addition & 1 deletion prototypes/game-test/game_info.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
"Pierre Burghardt"
],
"description": "Can you escape this spooky trap?",
"time": "2023-11-03",
"time": "2023-11-05",
"title": "Temple Sprint"
}
10 changes: 3 additions & 7 deletions prototypes/game-test/tiles.tres
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ texture_region_size = Vector2i(64, 64)
6:1/0 = 0
6:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:1/0/physics_layer_0/angular_velocity = 0.0
6:1/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
7:1/0 = 0
7:1/0/physics_layer_0/linear_velocity = Vector2(0, 0)
7:1/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -100,7 +99,6 @@ texture_region_size = Vector2i(64, 64)
6:2/0 = 0
6:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:2/0/physics_layer_0/angular_velocity = 0.0
6:2/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
7:2/0 = 0
7:2/0/physics_layer_0/linear_velocity = Vector2(0, 0)
7:2/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -136,7 +134,6 @@ texture_region_size = Vector2i(64, 64)
6:3/0 = 0
6:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:3/0/physics_layer_0/angular_velocity = 0.0
6:3/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
7:3/0 = 0
7:3/0/physics_layer_0/linear_velocity = Vector2(0, 0)
7:3/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -164,11 +161,11 @@ texture_region_size = Vector2i(64, 64)
4:4/0 = 0
4:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:4/0/physics_layer_0/angular_velocity = 0.0
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
4:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-21.25, 32, 20.25, 32, 20.75, -9, -21.75, -9.5)
5:4/0 = 0
5:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
5:4/0/physics_layer_0/angular_velocity = 0.0
5:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
5:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -8.48528, 32, -8.48528, 32, -32, -32, -32)
8:4/0 = 0
8:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
8:4/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -204,7 +201,6 @@ texture_region_size = Vector2i(64, 64)
6:5/0 = 0
6:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
6:5/0/physics_layer_0/angular_velocity = 0.0
6:5/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
8:5/0 = 0
8:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
8:5/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -350,7 +346,6 @@ texture_region_size = Vector2i(64, 64)
3:9/0 = 0
3:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
3:9/0/physics_layer_0/angular_velocity = 0.0
3:9/0/physics_layer_0/polygon_0/points = PackedVector2Array(-32, -32, 32, -32, 32, 32, -32, 32)
4:9/0 = 0
4:9/0/physics_layer_0/linear_velocity = Vector2(0, 0)
4:9/0/physics_layer_0/angular_velocity = 0.0
Expand Down Expand Up @@ -444,6 +439,7 @@ texture_region_size = Vector2i(64, 64)
0:4/0 = 0
0:4/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:4/0/physics_layer_0/angular_velocity = 0.0
0:4/0/physics_layer_0/polygon_0/points = PackedVector2Array(-5.75, 19, 6.75, 17.5, 6.25, 5.5, -6.25, 6)
0:5/0 = 0
0:5/0/physics_layer_0/linear_velocity = Vector2(0, 0)
0:5/0/physics_layer_0/angular_velocity = 0.0
Expand Down

0 comments on commit 4dab4fa

Please sign in to comment.