From 6df6e10ccfb179b95d7d83ed13bea880cbc21b6c Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Wed, 6 Sep 2023 12:13:21 -0700 Subject: [PATCH] deltatime --- levels/css1.gd | 4 ++-- title.gd | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/levels/css1.gd b/levels/css1.gd index 46cae7c..a79a7cf 100644 --- a/levels/css1.gd +++ b/levels/css1.gd @@ -13,7 +13,7 @@ func _process(delta): var ym = 0 var velocity = Vector2.ZERO if Input.get_joy_axis(0,JOY_AXIS_LEFT_X) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) > 0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_X) < -0.2 || Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) < -0.2: - velocity = (Vector2.RIGHT.rotated(rotation) * -400 * delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_X))-Vector2.UP.rotated(rotation) * -400 *delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) + velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_X))-Vector2.UP.rotated(rotation) * -50000 *delta * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) else: if Input.is_action_pressed("ui_left"): xm = -1 @@ -23,7 +23,7 @@ func _process(delta): ym = -1 if Input.is_action_pressed("ui_down"): ym = 1 - velocity = (Vector2.RIGHT.rotated(rotation) * -400 * xm * delta)-Vector2.UP.rotated(rotation) * -400 * ym * delta + velocity = (Vector2.RIGHT.rotated(rotation) * -50000 * xm * delta)-Vector2.UP.rotated(rotation) * -50000 * ym * delta #if Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) != 0: # velocity = Vector2.UP.rotated(rotation) * -400 * Input.get_joy_axis(0,JOY_AXIS_LEFT_Y) position += velocity * delta diff --git a/title.gd b/title.gd index bf07a7a..931f247 100644 --- a/title.gd +++ b/title.gd @@ -20,14 +20,14 @@ func _process(delta): func _input(event): # Mouse in viewport coordinates. - if event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER): + if Time.get_ticks_msec() >= 1000 && (event is InputEventMouseButton || Input.is_joy_button_pressed(0,JOY_BUTTON_X) || Input.is_joy_button_pressed(0,JOY_BUTTON_Y) || Input.is_joy_button_pressed(0,JOY_BUTTON_A) || Input.is_joy_button_pressed(0,JOY_BUTTON_B) || Input.is_joy_button_pressed(0,JOY_BUTTON_BACK) || Input.is_joy_button_pressed(0,JOY_BUTTON_START) || Input.is_joy_button_pressed(0,JOY_BUTTON_RIGHT_SHOULDER) || Input.is_joy_button_pressed(0,JOY_BUTTON_LEFT_SHOULDER)): #print("Mouse Click/Unclick at: ", event.position) _level() func _level(): # This is like autoloading the scene, only # it happens after already loading the main scene. - if fmod(Time.get_unix_time_from_system(), 2) == 0: + if randi() % 2 == 0: get_tree().change_scene_to_file("res://backgounds/galaxy.tscn") else: get_tree().change_scene_to_file("res://backgounds/wormhole.tscn")