Player movement. Mobile

  • Hi guys hope you're good.

    My player is just rotating and shooting when touching the screen. How do player move also while doing all that function. Like moving while shooting at the enemy. (Top down game)

  • Do you mean moving towards touch? You can use MoveTo behaviour to move towards touch position, or set the player as a bullet and set angle towards touch position, or you can use pathfinding towards touch position.

  • Hi, Yes like you would drag the player with your finger wherever on the screen. Dodging creatures and objects, etc.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Try out the drag and drop behaviour, you can use this to drag the player around, maybe that helps?

  • If you set the player sprite with the scroll behavior it will center it on the screen and the background will move behind it. You can do this with any movement behavior.

    yours

    winkr7

  • Thanks but what effect will this have on the other sprites that is attacking when the background moves? At this moment my player is on one spot and i can rotate him 360° with the touch, but no movement in the 8 directional.

  • scroll doesn't effect anything but where the view is centered--the coordinates of things on a layout are not effected by scroll.

    The best way to understand scroll and to build your programming skill is to just deal with a few sprites at a time. Start a new project, put some sprites on a layout set one of them to drag and drop-- drag it around-- then set it to scroll and drag it around. You are best off understanding each behavior with just a few things in the project before you start combining them into a real game.

    Just my 2 cents.

    yours

    winkr7

  • Hi

    I have some experience with moving sprite with touch and it was mostly a pain because I'm too used to mouse and keyboard.

    Anyways in my experience 8 directional is not good. Just use simple MoveTo behavior and set it like this:

    -> Touch - is in touch: Player MoveTo Touch.X, Touch.Y

    Change the MoveTo settings to make it go faster/slower.

    And use ScrollTo like winkr7 said so that your player is always centered. Scroll to doesn't move any objects or backgrounds, it works like a camera movement.

  • Thanks Spela, I will definitely try to do this. I appreciate the help from every so far. I will keep you guys posted. Thanks again.

  • I have tried all of the info you guys gave me, but still no movement. LOL its so frustrating. I will scratch a bit further and see if there are maybe something I missed.

  • Another idea

    Since your player is already rotating, you could try Move forward action. It doesn't require any extra behaviors. The condition would be Every tick (or as often as you want it) and the action Move forward 10 pixels (or as many as you want). Move forward uses current object angle and if you want to use a different angle, use the Move forward at an angle action.

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