Moving Background for Alien Attack

To give the Alien Attack lesson a little bit more of appeal, I found a way to make it look like the ship is moving fast across space (hope it looks ok enough on the video)

I just modified the Background in the game scene to make it twice as big in the horizontal axis and added the following code

func _physics_process(delta):
	slide_bg($Background)
	
func slide_bg(bg):
	var bg_size_x = bg.size.x / 2
	bg.global_position.x -=1
	var bg_x = bg.global_position.x
	if bg_size_x + bg_x == 0:
		bg.global_position.x = 0
1 Like

Privacy & Terms