0 Favourites

Simple RPG movement coding

  • Hey guys. I've got almost no past coding experiences so I'm having a difficult time thinking a solution for this.

    This is how my character moves (WASD movement)

    <img src="http://i.imgur.com/r5MQf.png" border="0" />

    Now this works pretty well, except for 2 things I can't figure out.

    1. When two buttons are pressed at once (ex. W and D) the character flies at a 45 degree angle. I want the player only to be able to press one button as once so I need a way to prevent this.

    2. I can't for the life of me let my character stop moving when he hits an object.

    Here is the capx if you wanna take a look.

    mediafire.com

    Thanks a bunch!

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Hey guys. I've got almost no past coding experiences so I'm having a difficult time thinking a solution for this.

    2. I can't for the life of me let my character stop moving when he hits an object.

    Here you are:   

    Bumping into the table from the Right side

    go around to the right side of the table with your character, keep a 1-2 meters distance, then press "A" and go toward the table, bump into it.

    To add another stop-command for the "S" key:

    1. Click on the thin purple space under the event that says "S is DOWN" so the whole event _and_ the thin space below gets orange

    2. Right-click that thin orange space

    3. Select "Add sub-event"

    4. Select your character sprite

    5. Click Next

    6. Select "Is overlapping another object"

    7. Next

    8. Click to chose select the sprite "Pokedesk"

    9. Done

    10. Add Action

    11. Select your Main character sprite

    12. Instance variables---> Set value Front 0

    13. Press and hold CTRL and click on the "Set animation to Front_Stop below", drag it above--> under the new "Set value Front 0" command.

    14. continue with the other directions.

    Nice graphics, by the way.

  • Hi, i saw both of your examples. The problem if you add that condition to all the directions is that once that overlaps the table no key is going to work, so the player get stock.

    Adding a simple comparison between both positions will solve that.

    Example: http://dl.dropbox.com/u/23880596/rpgtest2.capx

  • Whoa guys! Thanks so much.

    Love this community, you guys are amazing :)

  • How about implementing a directional attack - say with a non-shooting weapon?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
245 26,013
Ashodin's avatar
Ashodin
Unread hot topic
233 22,249
TiAm's avatar
TiAm
Unread hot topic
0 Favourites
My isometric RPG
99 15,189
TELLES0808's avatar
TELLES0808