summaryrefslogtreecommitdiff
path: root/demos/2d/platformer/moving_platform.gd
blob: 719d9e460e90aa7c4f71e8299e9b223cfcddcf2e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

extends Node2D

# member variables here, example:
# var a=2
# var b="textvar"

export var motion = Vector2()
export var cycle = 1.0
var accum=0.0

func _fixed_process(delta):

	accum += delta * (1.0/cycle) * PI * 2.0
	accum = fmod(accum,PI*2.0)
	var d = sin(accum)
	var xf = Matrix32()
	xf[2]= motion * d 
	get_node("platform").set_transform(xf)
		

func _ready():
	# Initalization here
	set_fixed_process(true)
	pass