Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node2D
- var x = 0
- var y = 0
- var speed = 1
- var state = 0
- func _ready():
- set_process(true)
- pass
- func _process(delta):
- update()
- func _draw():
- # x = x + speed
- draw_circle(Vector2(x,10),10,Color(255,255,255))
- if state == 0:
- x = x + speed
- if x > 200:
- x = 200
- state = 1
- elif state == 1:
- x = x - speed
- if x < 0:
- x = 0
- state = 0
- print(x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement