git init
This commit is contained in:
commit
80f2563cdc
95 changed files with 3327 additions and 0 deletions
20
code/GUI/restartschild.gd
Normal file
20
code/GUI/restartschild.gd
Normal file
|
@ -0,0 +1,20 @@
|
|||
extends Sprite2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
global_position.y = -80
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
global_position.x = get_viewport().get_visible_rect().size.x * 0.5
|
||||
|
||||
func _on_duck_gameover() -> void:
|
||||
$AnimationPlayer.play("in")
|
||||
show()
|
||||
|
||||
|
||||
func _on_restart_pressed() -> void:
|
||||
$"../..".start_game()
|
||||
$AnimationPlayer.play("out")
|
||||
await $AnimationPlayer.animation_finished
|
||||
hide()
|
18
code/GUI/startschild.gd
Normal file
18
code/GUI/startschild.gd
Normal file
|
@ -0,0 +1,18 @@
|
|||
extends Sprite2D
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
$AnimationPlayer.play("in")
|
||||
show()
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
global_position.x = get_viewport().get_visible_rect().size.x -51
|
||||
$Logo.global_position.x = 0
|
||||
|
||||
|
||||
func _on_start_pressed() -> void:
|
||||
$"../..".start_game()
|
||||
$AnimationPlayer.play("out")
|
||||
await $AnimationPlayer.animation_finished
|
||||
hide()
|
10
code/global.gd
Normal file
10
code/global.gd
Normal file
|
@ -0,0 +1,10 @@
|
|||
extends Node
|
||||
|
||||
|
||||
signal levelup
|
||||
signal start
|
||||
|
||||
var maxspeed = 260
|
||||
var speed = 100
|
||||
var score = 0
|
||||
var gamerunning = false
|
37
code/main.gd
Normal file
37
code/main.gd
Normal file
|
@ -0,0 +1,37 @@
|
|||
extends Node
|
||||
|
||||
func _ready() -> void:
|
||||
$Screen/Background/Floor/EasterEggFixCollision.disabled = false
|
||||
|
||||
func start_game():
|
||||
$Screen/Background/Floor/EasterEggFixCollision.disabled = true
|
||||
$Screen/SpawnTimer.start()
|
||||
$Screen/LevelUpTimer.start()
|
||||
$Screen/Duck.start()
|
||||
$Screen/HindernissSpawner.del_all()
|
||||
$Screen/EastereggSpawner.del_all()
|
||||
$"/root/Global".gamerunning = true
|
||||
$"/root/Global".start.emit()
|
||||
$"/root/Global".score = 0
|
||||
$"/root/Global".speed = 100
|
||||
|
||||
func _on_level_up_timer_timeout() -> void:
|
||||
if $"/root/Global".speed < $"/root/Global".maxspeed:
|
||||
$"/root/Global".speed += 10
|
||||
$"/root/Global".levelup.emit()
|
||||
|
||||
func _score() -> void:
|
||||
if not $"/root/Global".gamerunning:
|
||||
$Gui/Score.text = ""
|
||||
elif $Screen/Duck.alive:
|
||||
$"/root/Global".score += 10
|
||||
$Gui/Score.text = "Score: "+str($"/root/Global".score)
|
||||
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if $"/root/Global".gamerunning:
|
||||
$Screen/Background/Sprites.position.x -= $"/root/Global".speed*delta
|
||||
if $Screen/Background/Sprites.position.x <= -200:
|
||||
$Screen/Background/Sprites.position.x = 0
|
||||
|
9
code/score.gd
Normal file
9
code/score.gd
Normal file
|
@ -0,0 +1,9 @@
|
|||
extends Label
|
||||
|
||||
var speed = 70
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
#func _ready() -> void:
|
||||
#text = "0"
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
Loading…
Add table
Add a link
Reference in a new issue