Skip to content

Commit cb73586

Browse files
author
Marco Bakera
committed
respecting delta when moving tilemap.
1 parent 1c004af commit cb73586

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

godot_emu/Main.gd

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extends Node2D
22

33
var tmap: TileMap
44
var lbl: Label
5-
const STEP_SIZE = 5 # pixels
5+
const STEP_SIZE = 50 # pixels
66

77
# Called when the node enters the scene tree for the first time.
88
func _ready():
@@ -23,13 +23,13 @@ func _on_screen_resized():
2323
# Called every frame. 'delta' is the elapsed time since the previous frame.
2424
func _process(delta):
2525
if Input.is_action_pressed('ui_left'):
26-
tmap.position.x -= STEP_SIZE
26+
tmap.position.x -= STEP_SIZE * delta
2727
if Input.is_action_pressed('ui_right'):
28-
tmap.position.x += STEP_SIZE
28+
tmap.position.x += STEP_SIZE * delta
2929
if Input.is_action_pressed('ui_up'):
30-
tmap.position.y -= STEP_SIZE
30+
tmap.position.y -= STEP_SIZE * delta
3131
if Input.is_action_pressed('ui_down'):
32-
tmap.position.y += STEP_SIZE
32+
tmap.position.y += STEP_SIZE * delta
3333

3434
func _input(event):
3535
if event.is_action_pressed("ui_cancel"):

0 commit comments

Comments
 (0)