Build an isometric 3D game in 2D — #6 Movement adjusting

This is the final part of the 2d/3d(game/engine) conversion used in my puzzle game: Ladder Box, which is available on Steam:

Limit user input

In the last 5 part of this series, we’ve made all the states working, but we did not limit user input when the movable are moving, so this could happen:

I’m hitting a,z,x,s randomly
var _idle_count:int = 0
for i in sorted:
if i.get_node("state_machine").state.name == "idle":
_idle_count += 1
if _idle_count == sorted.size():

Beheavior Tweaking

Idle -> fall

Create a board as follows:

new_movable(0,0,0)
new_movable(0,1,0)

new_unmovable(1,1,0)
new_unmovable(1,2,0)
new_unmovable(1,3,0)
elif _msg.keys().has("reach_target"):
if Grid.coordinate_within_rangev(movable.game_pos + Vector3.DOWN) &&\
Grid.get_game_axisv(movable.game_pos + Vector3.DOWN) == null:
_state_machine.switch_state("fall",{})
pass
pass

Jumpable check

new_movable(0,0,0)
new_movable(0,2,0)

new_unmovable(0,1,0)
new_unmovable(0,1,1)

new_unmovable(0,0,3)
func is_direction_jumpable(direction:Vector3) -> bool:
if direction in [Vector3.UP,Vector3.DOWN]:
return false

var _self_up_coordinate = game_pos + Vector3.UP
if !Grid.coordinate_within_rangev(_self_up_coordinate):
return false
var _self_up_item = Grid.get_game_axisv(_self_up_coordinate)
if _self_up_item != null:
return false

var _self_up_up_coordinate = game_pos + Vector3.UP*2
if !Grid.coordinate_within_rangev(_self_up_up_coordinate):
return false
var _self_up_up_item = Grid.get_game_axisv(_self_up_up_coordinate)
if _self_up_up_item != null:
return false

var _direction_up_axie = game_pos + direction + Vector3.UP
if !Grid.coordinate_within_rangev(_direction_up_axie):
return false

var _direction_up_item = Grid.get_game_axisv(_direction_up_axie)
if _direction_up_item != null:
return false

return true

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store