among-eux

Game made in 1 day with flx
git clone git://git.vgx.fr/among-eux
Log | Files | Refs

commit 45aaa325535971b6f49c618148c23813c11e5008
parent d25488ab585385a74be4950d33442c8409b585a5
Author: Léo Villeveygoux <l@vgx.fr>
Date:   Mon, 29 Aug 2022 01:21:14 +0200

Release!

Diffstat:
M.gitignore | 1+
MEvil.tscn | 3---
MGameOverScreen.gd | 6++++--
MGameOverScreen.tscn | 8++++++++
MGuard.gd | 7+++++--
MLevels.tscn | 7++++++-
MPresident.gd | 10+++++++++-
MPublic.gd | 2+-
MPublic.tscn | 1+
MStartScreen.gd | 2+-
Aexport_presets.cfg | 34++++++++++++++++++++++++++++++++++
Asounds/president.mp3 | 0
Asounds/president.mp3.import | 15+++++++++++++++
13 files changed, 85 insertions(+), 11 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1 +1,2 @@ .import +export diff --git a/Evil.tscn b/Evil.tscn @@ -6,7 +6,4 @@ [node name="Public" instance=ExtResource( 1 )] script = ExtResource( 2 ) -[node name="Sprite" parent="." index="0"] -frame = 1 - [connection signal="body_entered" from="." to="." method="_on_Public_body_entered"] diff --git a/GameOverScreen.gd b/GameOverScreen.gd @@ -5,10 +5,12 @@ extends Node2D # var a = 2 # var b = "text" +var lvl = 0 + # ## Called when the node enters the scene tree for the first time. -#func _ready(): -# pass # Replace with function body. +func _ready(): + $Label.text = "lvl: " + String(lvl) func _unhandled_input(event): if event is InputEventMouseButton: diff --git a/GameOverScreen.tscn b/GameOverScreen.tscn @@ -9,3 +9,11 @@ script = ExtResource( 2 ) [node name="Gameover" type="Sprite" parent="."] position = Vector2( 256, 150 ) texture = ExtResource( 1 ) + +[node name="Label" type="Label" parent="."] +margin_left = 447.0 +margin_top = 278.0 +margin_right = 487.0 +margin_bottom = 292.0 +text = "lvl: 1" +align = 2 diff --git a/Guard.gd b/Guard.gd @@ -14,17 +14,20 @@ export var dash_duration = .3 var target = Vector2() var dash_state = -dash_timeout +var last_click = 0.0 # Called when the node enters the scene tree for the first time. func _ready(): target = position func _unhandled_input(event): - if event is InputEventMouseButton: + if event is InputEventMouseButton and event.pressed: + var date = Time.get_ticks_msec() target = event.position - if event.doubleclick and dash_state <= -dash_timeout: + if (event.doubleclick or date-last_click < 250.0 ) and dash_state <= -dash_timeout: dash_state = dash_duration $Dash.visible = true + last_click = date func _physics_process(delta): var to_target = target - position diff --git a/Levels.tscn b/Levels.tscn @@ -1,6 +1,11 @@ -[gd_scene load_steps=2 format=2] +[gd_scene load_steps=3 format=2] [ext_resource path="res://Levels.gd" type="Script" id=1] +[ext_resource path="res://sounds/president.mp3" type="AudioStream" id=2] [node name="Levels" type="Node2D"] script = ExtResource( 1 ) + +[node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] +stream = ExtResource( 2 ) +autoplay = true diff --git a/President.gd b/President.gd @@ -2,6 +2,8 @@ extends RigidBody2D export var max_speed = 30.0 +var gameover_scn = preload("res://GameOverScreen.tscn") + func _ready(): contact_monitor = true contacts_reported = 10 @@ -26,4 +28,10 @@ func _integrate_forces(state): func _on_President_body_entered(body): if body is Evil: - get_tree().change_scene("res://GameOverScreen.tscn") + var lvl = get_parent().get_parent().lvl + #get_tree().change_scene("res://GameOverScreen.tscn") + #get_viewport().get_child(0).lvl = lvl + var gameover = gameover_scn.instance() + gameover.lvl = get_parent().get_parent().lvl + get_parent().get_parent().add_child(gameover) + max_speed = 0 diff --git a/Public.gd b/Public.gd @@ -12,7 +12,7 @@ func init(): if position == Vector2(): var vp_size = get_viewport_rect().size - position.x = rand_range(vp_size.x/10, vp_size.x-30.0) + position.x = rand_range(vp_size.x/5, vp_size.x-30.0) position.y = rand_range(30.0, vp_size.y-30.0) if type == -1: diff --git a/Public.tscn b/Public.tscn @@ -17,6 +17,7 @@ __meta__ = { [node name="Sprite" type="AnimatedSprite" parent="."] frames = ExtResource( 1 ) animation = "down" +frame = 2 playing = true [node name="CollisionShape2D" type="CollisionShape2D" parent="."] diff --git a/StartScreen.gd b/StartScreen.gd @@ -12,5 +12,5 @@ extends Node2D # func _unhandled_input(event): - if event is InputEventMouseButton: + if event is InputEventMouseButton and event.pressed: get_tree().change_scene("res://Levels.tscn") diff --git a/export_presets.cfg b/export_presets.cfg @@ -0,0 +1,34 @@ +[preset.0] + +name="HTML5" +platform="HTML5" +runnable=true +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="export/index.html" +script_export_mode=1 +script_encryption_key="" + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +variant/export_type=0 +vram_texture_compression/for_desktop=true +vram_texture_compression/for_mobile=false +html/export_icon=true +html/custom_html_shell="" +html/head_include="" +html/canvas_resize_policy=2 +html/focus_canvas_on_start=true +html/experimental_virtual_keyboard=false +progressive_web_app/enabled=false +progressive_web_app/offline_page="" +progressive_web_app/display=1 +progressive_web_app/orientation=0 +progressive_web_app/icon_144x144="" +progressive_web_app/icon_180x180="" +progressive_web_app/icon_512x512="" +progressive_web_app/background_color=Color( 0, 0, 0, 1 ) diff --git a/sounds/president.mp3 b/sounds/president.mp3 Binary files differ. diff --git a/sounds/president.mp3.import b/sounds/president.mp3.import @@ -0,0 +1,15 @@ +[remap] + +importer="mp3" +type="AudioStreamMP3" +path="res://.import/president.mp3-1c2234f8f36b1d10977b80e09a0e7af3.mp3str" + +[deps] + +source_file="res://sounds/president.mp3" +dest_files=[ "res://.import/president.mp3-1c2234f8f36b1d10977b80e09a0e7af3.mp3str" ] + +[params] + +loop=true +loop_offset=0