Pixel-precise custom movement on a grid.

0 favourites
From the Asset Store
Snap to visible grid - perfect solution for any game genre
  • Greg

    There's no such bug on my side, I used this system in tones of different situations (including patroling AI) and never had any issue even at super high speed.

    Do you get this bug in the original capx, or in a modified version of yours?

  • Thank you for the response, I really appreciate you taking the time to look into this!

    The original capx can have the issue but it is very difficult to get it to go into a wall. I download it and playtest for a few minutes and can run into the wall after trying for a few minutes (moving along a wall and turning towards it constantly). Not always or easily, but it is possible.

    If you turn the speed down the collision detector lags behind the player more noticeably. Setting the speed to 128 and stepping to 0 makes it much easier to run through walls. It's unfortunate because 256+ is too fast for my needs, I want a classic looking slow grid movement :(

    I really like the script, so didn't want to use anything different, and I've built other scripts that rely on this script to work. I will keep looking into it, but I am no programmer lol!

  • Try Construct 3

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

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

    What C2 release are you using? The logic of the capx is sound, the wall detector is doing exactly what it is designed to do: it checks the next grid position before moving. The position lag is not the issue.

  • I am using r99. I noticed the issue initially on r96, but never reported it because I wanted to try and get it fixed without begging for help on the forums.

    I think the issue is related to lowering the stepping below 0.1 is the cause of "lag" on the collision detector. 128 speed with 0 stepping makes it easy to see.

    Thank you for taking an interest and looking into it!

  • I don't think it's a problem with the events. I have not been able to move into the walls.

    What browser are you using to test?

    It's flawless for me in Firefox 14.0.1 and Chrome 20.0.1132.47.

  • Greg R0J0hound

    I see, in some rare cases the algo skip the wall check.

    It can happen only if Player.move reach 0 without going into negative values. And the lower the speed the more likely it can happen.

    Greg, to correct the problem you just have to put in event 10:

    Player: move = 0 
      -> System: Set timer to max(0,timer-dt)
      -> Player: Set checked to false  <-- that
  • Sorry I couldn't get back to you sooner about this, but it works flawlessly! Thank you so much!

  • dl.dropbox.com/u/23551572/C2/gridMovement.capx

    thanks for sharing Jann. it's a great example. very useful to me. <img src="smileys/smiley42.gif" border="0" align="middle" />

  • Yann About the grid-movements, what If Player intended to change direction without moving? Thanks

  • Jaydon > yeah? what about it?

  • Yann in your example capx, the player moves forward with any direction key is pressed. What if I intended to have the player change direction rather than moving forward. If the player faced the direction it is moving, it will then move forward on direction key pressed.

    Key hold more than x ticks - moves forward

    else - only change direction (no moving forward)

    I've tried different approaches to this but I've sort of stuck. Do let me know if you need more explanation. You can take Pokemon grid movement as an example.

  • hello guys!!!

    how i make the drag and drop keep the grid positions!!!

    thanks !!!

    AJ

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