ADD: checkpoints.
parent
89df0e6b75
commit
af4f5062b7
|
@ -0,0 +1,16 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(_delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_body_entered(body):
|
||||||
|
if body in get_tree().get_nodes_in_group('player'):
|
||||||
|
CheckPoint.add_checkpoint(name, body.global_position)
|
|
@ -0,0 +1,16 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://ba7detpptxamr"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://CheckPointArea/check_point_area.gd" id="1_6wlyr"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_7yleu"]
|
||||||
|
radius = 51.4781
|
||||||
|
|
||||||
|
[node name="CheckPointArea" type="Area2D"]
|
||||||
|
script = ExtResource("1_6wlyr")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
position = Vector2(2, 2)
|
||||||
|
shape = SubResource("CircleShape2D_7yleu")
|
||||||
|
debug_color = Color(0.972549, 0, 0.443137, 0.419608)
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
|
@ -0,0 +1,37 @@
|
||||||
|
extends Node
|
||||||
|
|
||||||
|
class CheckPointData:
|
||||||
|
var checkpoint_name
|
||||||
|
var player_position
|
||||||
|
var strikes: bool = false
|
||||||
|
|
||||||
|
func _init(myname, ppos):
|
||||||
|
checkpoint_name = myname
|
||||||
|
player_position = ppos
|
||||||
|
|
||||||
|
var m_checkpoints = []
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func reset():
|
||||||
|
m_checkpoints.clear()
|
||||||
|
|
||||||
|
func add_checkpoint(name, pos):
|
||||||
|
for cp in m_checkpoints:
|
||||||
|
if cp.checkpoint_name == name:
|
||||||
|
return
|
||||||
|
var strikes = false
|
||||||
|
if m_checkpoints.is_empty() == false:
|
||||||
|
strikes = m_checkpoints.back().strikes
|
||||||
|
m_checkpoints.push_back(CheckPointData.new(name, pos))
|
||||||
|
m_checkpoints.back().strikes = strikes
|
||||||
|
|
||||||
|
func has_checkpoint():
|
||||||
|
return m_checkpoints.is_empty() == false
|
||||||
|
|
||||||
|
func get_checkpoint():
|
||||||
|
return m_checkpoints.back()
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,29 @@
|
||||||
|
extends Node2D
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
if CheckPoint.has_checkpoint():
|
||||||
|
var cp = CheckPoint.get_checkpoint()
|
||||||
|
$Sandbox/Player/Actor.global_position = cp.player_position
|
||||||
|
$Sandbox.strike_enabled = cp.strikes
|
||||||
|
|
||||||
|
var msg = preload("res://MsgBox/msg_box.tscn").instantiate()
|
||||||
|
$Sandbox/Canvas.add_child(msg)
|
||||||
|
msg.enable('Hello prisoner', '
|
||||||
|
Hello prisoner,
|
||||||
|
Our spaceship is under attack, but don\'t worry,
|
||||||
|
you will be executed at time, as soon as we escape.
|
||||||
|
Good luck !
|
||||||
|
')
|
||||||
|
|
||||||
|
func _start():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
func _on_area_2d_body_entered(body):
|
||||||
|
$Sandbox.strike_enabled = true
|
||||||
|
if CheckPoint.has_checkpoint():
|
||||||
|
CheckPoint.get_checkpoint().strikes = true
|
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,19 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
|
# Called when the node enters the scene tree for the first time.
|
||||||
|
func _ready():
|
||||||
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _on_button_pressed():
|
||||||
|
CheckPoint.reset()
|
||||||
|
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
||||||
|
|
||||||
|
func _on_checkpoint_pressed():
|
||||||
|
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
[gd_scene format=3 uid="uid://ch3n607i8yqy8"]
|
[gd_scene load_steps=2 format=3 uid="uid://ch3n607i8yqy8"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://LoseMenu/lose_menu.gd" id="1_0ixcu"]
|
||||||
|
|
||||||
[node name="LoseMenu" type="Control"]
|
[node name="LoseMenu" type="Control"]
|
||||||
layout_mode = 3
|
layout_mode = 3
|
||||||
|
@ -7,6 +9,7 @@ anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_0ixcu")
|
||||||
|
|
||||||
[node name="ColorRect" type="ColorRect" parent="."]
|
[node name="ColorRect" type="ColorRect" parent="."]
|
||||||
layout_mode = 1
|
layout_mode = 1
|
||||||
|
@ -24,3 +27,22 @@ offset_top = 54.0
|
||||||
offset_right = 551.0
|
offset_right = 551.0
|
||||||
offset_bottom = 77.0
|
offset_bottom = 77.0
|
||||||
text = "YOU LOSE"
|
text = "YOU LOSE"
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 499.0
|
||||||
|
offset_top = 192.0
|
||||||
|
offset_right = 555.0
|
||||||
|
offset_bottom = 223.0
|
||||||
|
text = "RETRY"
|
||||||
|
|
||||||
|
[node name="Checkpoint" type="Button" parent="."]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 468.0
|
||||||
|
offset_top = 131.0
|
||||||
|
offset_right = 598.0
|
||||||
|
offset_bottom = 162.0
|
||||||
|
text = "Last checkpoint"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||||
|
[connection signal="pressed" from="Checkpoint" to="." method="_on_checkpoint_pressed"]
|
||||||
|
|
|
@ -1,15 +1,13 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _ready():
|
func _ready():
|
||||||
pass # Replace with function body.
|
pass # Replace with function body.
|
||||||
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
func _process(_delta):
|
func _process(_delta):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
func _on_button_pressed():
|
func _on_button_pressed():
|
||||||
get_tree().change_scene_to_file("res://Levels/level_0.tscn")
|
get_tree().change_scene_to_file("res://Levels/level_intro.tscn")
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
extends Area2D
|
||||||
|
|
||||||
|
@export var title: String = ''
|
||||||
|
@export var text: String = ''
|
||||||
|
|
||||||
|
var m_bodies = []
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _on_body_entered(body):
|
||||||
|
if body in m_bodies:
|
||||||
|
return
|
||||||
|
var msg = preload("res://MsgBox/msg_box.tscn").instantiate()
|
||||||
|
$CanvasLayer.add_child(msg)
|
||||||
|
msg.enable(title, text)
|
||||||
|
m_bodies.push_back(body)
|
|
@ -0,0 +1,16 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://bp8sjj34r7jyj"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://MsgArea/msg_area.gd" id="1_fqh47"]
|
||||||
|
|
||||||
|
[sub_resource type="CircleShape2D" id="CircleShape2D_co7u0"]
|
||||||
|
radius = 41.1947
|
||||||
|
|
||||||
|
[node name="MsgArea" type="Area2D"]
|
||||||
|
script = ExtResource("1_fqh47")
|
||||||
|
|
||||||
|
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||||
|
shape = SubResource("CircleShape2D_co7u0")
|
||||||
|
|
||||||
|
[node name="CanvasLayer" type="CanvasLayer" parent="."]
|
||||||
|
|
||||||
|
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
|
@ -0,0 +1,40 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
class Page:
|
||||||
|
var title: String
|
||||||
|
var text: String
|
||||||
|
|
||||||
|
func _init(mytitle, mytext):
|
||||||
|
self.title = mytitle
|
||||||
|
self.text = mytext
|
||||||
|
|
||||||
|
var m_pages = []
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
func _ready():
|
||||||
|
pass
|
||||||
|
|
||||||
|
func _process(delta):
|
||||||
|
if Input.is_action_just_pressed("ui_accept"):
|
||||||
|
self._on_button_pressed()
|
||||||
|
|
||||||
|
func enable(title, text):
|
||||||
|
$Panel/VBoxContainer/Label.text = title
|
||||||
|
$Panel/VBoxContainer/RichTextLabel.text = text
|
||||||
|
|
||||||
|
get_tree().paused = true
|
||||||
|
return self
|
||||||
|
|
||||||
|
func then(title, text):
|
||||||
|
m_pages.push_back(Page.new(title, text))
|
||||||
|
return self
|
||||||
|
|
||||||
|
func _on_button_pressed():
|
||||||
|
if m_pages.size() > 0:
|
||||||
|
var page = m_pages.pop_front()
|
||||||
|
$Panel/VBoxContainer/Label.text = page.title
|
||||||
|
$Panel/VBoxContainer/RichTextLabel.text = page.text
|
||||||
|
else:
|
||||||
|
get_tree().paused = false
|
||||||
|
queue_free()
|
|
@ -0,0 +1,57 @@
|
||||||
|
[gd_scene load_steps=3 format=3 uid="uid://82kxvlr252x4"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" path="res://MsgBox/msg_box.gd" id="1_5d2k7"]
|
||||||
|
|
||||||
|
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_msojn"]
|
||||||
|
|
||||||
|
[node name="MsgBox" type="Control"]
|
||||||
|
process_mode = 3
|
||||||
|
layout_mode = 3
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("1_5d2k7")
|
||||||
|
|
||||||
|
[node name="Panel" type="Panel" parent="."]
|
||||||
|
top_level = true
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 8
|
||||||
|
anchor_left = 0.5
|
||||||
|
anchor_top = 0.5
|
||||||
|
anchor_right = 0.5
|
||||||
|
anchor_bottom = 0.5
|
||||||
|
offset_left = -253.0
|
||||||
|
offset_top = -221.0
|
||||||
|
offset_right = 253.0
|
||||||
|
offset_bottom = 221.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
theme_override_styles/panel = SubResource("StyleBoxFlat_msojn")
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
|
||||||
|
layout_mode = 1
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "TITRE"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
bbcode_enabled = true
|
||||||
|
text = "text"
|
||||||
|
fit_content = true
|
||||||
|
|
||||||
|
[node name="Button" type="Button" parent="Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
size_flags_vertical = 8
|
||||||
|
text = "OK"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="Panel/VBoxContainer/Button" to="." method="_on_button_pressed"]
|
|
@ -1,10 +1,11 @@
|
||||||
extends Node2D
|
extends Node2D
|
||||||
|
|
||||||
|
@export var strike_enabled = true
|
||||||
var m_broken_timer = 0.0
|
var m_broken_timer = 0.0
|
||||||
var m_broken_time = 0.2
|
var m_broken_time = 0.2
|
||||||
var process_state = null
|
var process_state = null
|
||||||
var m_death_timer = 0.0
|
var m_death_timer = 0.0
|
||||||
var m_death_time = 2.0
|
var m_death_time = 1.0
|
||||||
|
|
||||||
var m_strike_time = 1.0
|
var m_strike_time = 1.0
|
||||||
var m_strike_timer = 0.0
|
var m_strike_timer = 0.0
|
||||||
|
@ -21,13 +22,22 @@ func _process(delta):
|
||||||
if self.process_state:
|
if self.process_state:
|
||||||
self.process_state.call(delta)
|
self.process_state.call(delta)
|
||||||
|
|
||||||
|
func filter_near_player(pos):
|
||||||
|
var glob_pos = to_global($TileMap.map_to_local(pos))
|
||||||
|
var to_player = $Player/Actor.global_position - glob_pos
|
||||||
|
var dist2 = to_player.length_squared()
|
||||||
|
var min_dist = 300
|
||||||
|
var max_dist = 128
|
||||||
|
return dist2 < min_dist * min_dist and dist2 > max_dist * max_dist
|
||||||
|
|
||||||
func process(delta):
|
func process(delta):
|
||||||
for actor in get_tree().get_nodes_in_group('actors'):
|
for actor in get_tree().get_nodes_in_group('actors'):
|
||||||
if is_outside(actor) and actor.is_normal():
|
if is_outside(actor) and actor.is_normal():
|
||||||
actor.to_falling()
|
actor.to_falling()
|
||||||
|
|
||||||
if m_strike_timer >= m_strike_time:
|
if m_strike_timer >= m_strike_time and strike_enabled:
|
||||||
var all = $TileMap.get_used_cells(0)
|
var all = $TileMap.get_used_cells(0)
|
||||||
|
all = all.filter(filter_near_player)
|
||||||
all.shuffle()
|
all.shuffle()
|
||||||
var ground = null
|
var ground = null
|
||||||
for t in all:
|
for t in all:
|
||||||
|
@ -35,6 +45,7 @@ func process(delta):
|
||||||
if data.get_custom_data('type') == 'ground':
|
if data.get_custom_data('type') == 'ground':
|
||||||
ground = t
|
ground = t
|
||||||
break
|
break
|
||||||
|
if ground:
|
||||||
self.add_broken_ground(ground, 1, 0.8)
|
self.add_broken_ground(ground, 1, 0.8)
|
||||||
$Strikes.add_line(to_global($TileMap.map_to_local(ground)), 0.15)
|
$Strikes.add_line(to_global($TileMap.map_to_local(ground)), 0.15)
|
||||||
m_strike_timer = 0.0
|
m_strike_timer = 0.0
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
[preset.0]
|
||||||
|
|
||||||
|
name="Linux/X11"
|
||||||
|
platform="Linux/X11"
|
||||||
|
runnable=true
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path="../../Export/hello.x86_64"
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.0.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=1
|
||||||
|
binary_format/embed_pck=false
|
||||||
|
texture_format/bptc=true
|
||||||
|
texture_format/s3tc=true
|
||||||
|
texture_format/etc=false
|
||||||
|
texture_format/etc2=false
|
||||||
|
binary_format/architecture="x86_64"
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||||
|
export DISPLAY=:0
|
||||||
|
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||||
|
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||||
|
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||||
|
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||||
|
rm -rf \"{temp_dir}\""
|
|
@ -15,6 +15,10 @@ run/main_scene="res://MainMenu/main_menu.tscn"
|
||||||
config/features=PackedStringArray("4.2", "GL Compatibility")
|
config/features=PackedStringArray("4.2", "GL Compatibility")
|
||||||
config/icon="res://icon.svg"
|
config/icon="res://icon.svg"
|
||||||
|
|
||||||
|
[autoload]
|
||||||
|
|
||||||
|
CheckPoint="*res://Checkpoint/CheckPoint.gd"
|
||||||
|
|
||||||
[input]
|
[input]
|
||||||
|
|
||||||
player_up={
|
player_up={
|
||||||
|
|
Loading…
Reference in New Issue