Map-Based Grid Movement

This cart demonstrates simple map-based grid movement. It is heavily commented so you can pull apart how this is being achieved.

  Notes: Sprites that you want to be blocking tiles (meaning the player can't walk through them), should have the first sprite flag turned on.

  The basic idea is that when the player tries to move, we store the coordinates of where they are trying to go. Then we check those new coordinates to see if the map tile in that spot has a sprite flag of 1 or not. If it does, we just ignore the player's attempt at moving. But if it doesn't, we change the player's location to the new coordinates and play a footstep sound.

Development log

Comments
Welcome to zddgame comments! Please keep conversations courteous and on-topic. To fosterproductive and respectful conversations, you may see comments from our Community Managers.
Sign up to post
Sort by
Show More Comments

  

Copyright 2023-2024 - www.zddgame.com All Rights Reserved