how to move character left and right on isometric game

0 favourites
  • 4 posts
From the Asset Store
A complete set of graphical user interface (GUI) to build 2D video games. With wood, nature, & jungle theme
  • like subway surfer , the road has 3 paths , i want the character to move right when swipe right and left when swipe left.

  • One simple way to do this:

    1. create a global variable to keep track of which lane is the player in. Let's call it "globalLane".

    2. from player's swipe left/right, you increase/decrease globalLane by 1, but make sure they are only in the range of 0 to 2. You can do something like, for example: globalLane = max(0, min(2, globalLane) after you increase/decrease it.

    3. create a new object and call it "signalObj". Every tick, do this:

    if globalLane = 0, set signalObj.X = 100, signalObj.Y = 300.

    if globalLane = 1, set signalObj.X = 200, signalObj.Y = 300.

    if globalLane = 2, set signalObj.X = 300, signalObj.Y = 300.

    4.Create a player object, and in the event sheet, do this every tick :

    player move towards signalObj. You can use:

    [quote:aybkn2pz]Move at angle

    Move the object a number of pixels at a given angle in degrees.

    So: player Move 100*dt pixels at angle angle(player.X, player.Y, signalObj.X, signalObj.Y)

    All these above should give you a basic idea to do what you want. Of course, this is just a basic simpler implementation idea, and not the best way to implement.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • After you understand the concept above, the next would be start throwing obstacles (probably woth Bullet behavior) that spawn at the top and come down in each lane.

    Now, for the isometric part, this will depend on your aesthetic design and art, but it is not much different from non-isometric view. Maybe try add some art assets and try play around with it.

  • Check out this tutorial. It's not isometric, but it's about making the swiping and multi-touch work on the mobile environment. <img src="{SMILIES_PATH}/icon_mrgreen.gif" alt=":mrgreen:" title="Mr. Green">

    https://www.scirra.com/tutorials/4973/m ... t-controls

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