![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
Asked By | Mohan |
![]() |
Old Version | Published before Godot 3 was released. |
`Hello, Godot community.
I am fairly new to game development, and I have been trying to make this Sokoban clone in Godot. I got the player input and movement working. I also got the collision with certain blocks working. However, I can’t figure out how to make the player move the boxes.
Here is the player script:
extends KinematicBody2D
func _fixed_process(delta):
if(Input.is_action_pressed("player_down")):
move(Vector2(0,8))
if(Input.is_action_pressed("player_up")):
move(Vector2(0,-8))
if(Input.is_action_pressed("player_left")):
move(Vector2(-8,0))
if(Input.is_action_pressed("player_right")):
move(Vector2(8,0))
func _ready():
set_fixed_process(true)
pass
Both the player and the box are kinematic bodies with their own collision shapes in their own scenes. I am instantiating both of them in a different level scene.
Thanks beforehand.