suchwow
A snake game in progress
Video · 1280 × 720 · 1:20 · 25.4 MB
Description
A snake game in progress, with the snake eating an apple and growing longer with each bite, demonstrating the classic 'eat to grow' mechanic.
Text in this meme
elif Input.is_action_pressed("ui_left"): move_dir = Vector2.LEFT # (-1,0) func _physics_process(delta): time_since_last_move += delta * speed if time_since_last_move >= time_between_moves: update_snake() time_since_last_move = 0 func update_snake(): #move var new_head = head.position + move_dir new_head.x = int(new_head.x) head.move_to(new_head) for i in range(len(snake_parts) - 1, 0, -1): snake_parts[i].position = snake_parts[i-1].position snake_parts[0].position = new_head func _on_food_eaten(food:Food): print("Food eaten") spawn_new_food() func _on_tail_added(tail:Tail): snake_parts.push_back(tail)