How do I handle roguelike movement and walls?

1 favourites
  • 3 posts
From the Asset Store
Wall Pin Board is a hyper causal game developed for fun and inspired by YouTube video whose link is given in description
  • Hi guys,

    I have a bit of a quandry. I tracked down an example .capx (sorry, can't remember the author but it's around here) that lets you do roguelike movements (where the player moves 1 tile in the direction you tell them to go). This is good but there are some questions that arise from it.

    I've constructed my world with two tilemaps, one for the floor and one for the walls (with the solid behavior attached to the walls tilemap). The walls one is a clone of the floor with the walkable area erased and the remaining walls blocking the player from moving.

    This all works great but now I'd like to have my player do the roguelike movement. The example .capx has everything being handled manually via the keyboard along with all the walls as sprites with collision detection. If I were to implement this I would have to redo my walls tilemap using a sprite by hand (given that my map is 100 tiles by 75, that's a freakin' long time to set these up).

    Right now I have the player with an 8Dir behavior attached (set to allow up/down/left/right) but that's moving pixel by pixel rather than tile by tile.

    So the question is: is the example where you handle everything using the Keyboard object (and sprite walls) the only way to do roguelike movement? Is there a way to hook into the 8Dir behavior to modify the player position by tile width rather than single pixel movement?

    Thanks.

  • There are a few roguelike examples on the forums. I think I've made a couple so it could have been one of mine.

    In the example you used you say that the collisions are wall sprites. Why not just change this to check for a collision with your solid walls tilemap?

    8Dir movement is designed for pixel by pixel movement, to get it to move tile by tile would need you to make the keyboard events yourself anyway because default controls won't let you do it, so I think the example is the best way to go here.

    Setting up your own keyboard basic controls takes only a few minutes and gives you a lot more control over you player. Plus if you add any other controls such as a magic/attack you would have to use use the keyboard object anyway.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hi Minor

    Yes, I think it was your example that I was looking at. Didn't realize I could check for a collision with the tilemap since the 8Dir already does that. I was trying to use as much out-of-the-box stuff as I could as it offered a lot of optimizations that I didn't want to do myself but it seems like it's the only way. I was hoping there was some kind of setting I could hook in/override like how far my player sprite moved on each keypress with the 8Dir behaviour. I'll go back and take a look at the example and try that. It seems to give me the end result that I'm looking for.

    Thanks

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)