Snake 10 - Like to move :3

 avatar
TaktycznyBocian
plain_text
2 years ago
448 B
9
Indexable
Never
func move_snake() :
	if add_point:
		delete_tiles(snake)
		var body_copy = snake_body.slice(0,snake_body.size() - 1)
		var new_head = body_copy[0] + snake_direction
		body_copy.insert(0, new_head)
		snake_body = body_copy
		add_point = false
	else:
		delete_tiles(snake)
		var body_copy = snake_body.slice(0,snake_body.size() - 2)
		var new_head = body_copy[0] + snake_direction
		body_copy.insert(0, new_head)
		snake_body = body_copy