0 Favourites

A custom enemy movement

  • Hello everyone,

    This is my first post in your great forum...

    I am testing the SCIRRA software to create a HTML 5 game.

    I would like to ask you a question:

    How to apply to custom movement for a enemy (which is normally a sprite object) based on the X axis(= I mean horizental move)?

    I couldn't find a simple tutorial and I am a newbie with SCIRRA

    <img src="smileys/smiley12.gif" border="0" align="middle" />

    Thanks in advance <img src="smileys/smiley32.gif" border="0" align="middle" />

  • Hello newgamer

    Here is a great patrolling example made by JohnnySix showing you how you can achieve this:

    Patrolling Example

    There is a download link for the example .capx in the description.

    Welcome to Scirra <img src="smileys/smiley1.gif" border="0" align="middle">

  • You can also simply assign the bullet behavior to your enemy which will automatically give them a linear movement which you can then use your events and logic to tweak.

  • Thank you very much both of you gentel men!

    I tried to implement BluePhaze solution, indeed I asseigned the bullet behaviour to my enemy(which is supposed to move above a wall), then I added a condition just like that:

    (to perform the left movement)

    System -> Every tick -> myenemy : Move 3 pixels at angle 180

    until now, it works!!!

    Then, I want to make it back when he arrived to the wall limit( the right movement), I want to compare the wall X and my enemy X coordinates:

    myenemy -> X <= wall.X : myenemy: Move 3 pixels at angle 0

    but the problem is that myenemy object didn't turn back :(

    What was my mistake?

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Is there any other solution to make my enemy goes back when he arrived to the wall limit? <img src="smileys/smiley34.gif" border="0" align="middle" />

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