Another post about enemy movement

0 favourites
  • 6 posts
From the Asset Store
We present to you “Post Apocalyptic Trailer” – our newest hard hitting, bass rumbling designed movie trailer collection.
  • Hi all,

    First post here. I saw there are a few similar questions, but couldn't find one specific to my issue, so here it is:

    Trying to make a basic platformer. The player physics are fine, and the enemy movement is fine, but when the enemy changes direction, the sprite rotates with it. So for example if it's in the correct position going right, it will rotate to be upside down when it comes back left. What I need is for it to face in the direction it is moving on the horizontal axis.

    I was able to do this for the character by creating conditions such as "When right arrow pressed, mirror sprite", but I can't do that for enemies because they aren't controlled by input, so I can't apply the same conditions.

    Is there some way of basically saying "when moving left, mirror image, and don't spin it around or upside down"?

    Thanks in advance for any help.

    Edit: Link for the capx file. As you'll be able to see, I'm just getting started and experimenting a little. The first thing that happens is the dragon spins upside down when he's supposed to be following the little guy.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Please? Anyone? It doesn't seem like it would be a hard thing to do, there must just be some simple button somewhere that I'm missing or something, surely?

  • Hey Monsta,

    What I do is handle the enemies animation and movement the same way as the player. Give them the relevant behaviour and then turn off "default control" in the sidebar when you have the enemy selected. Use "Simulate control" in the system commands to issue movement commands like follow the player etc.

    Your dragon moves to the right at the start because you have bullet behaviour - and you first order to the dragon is after 2 seconds. IE - every 2 seconds set angle to player.

    I updated your cap, made an adjustment to your dragon image, set the "set angle" property to yes and added a condition to change the image if the player is on the left or right.

    dl.dropbox.com/u/13312935/Howisthis..capx

  • Wow, you are completely brilliant, thank you so much! I have another unrelated question but don't want to start another thread for it, so going to post here if it's ok:

    dl.dropbox.com/u/66278067/Spacegog.capx

    I used "scroll to" on the character, but I want him to be left of center like in a normal game of it's genre, instead of dead center. I'm sorry to be such a noob, but I have tried and failed.

    Thanks in advance for any further help, and thanks once again for the help so far :)

  • all you need for this is to add a new sprite (can be without and image) in the middle of the screen and attach the scroll to behaviour to it, instead of the player character. At the events, add the move to instruction for the new sprite and you are ready to go.

  • Ahhh, thanks Ubivis!! And I supposed if i want the character to be able to move forward and backwards, I can make a condition for the character sprite and the "invisible sprite" to remain a set distance from each other, to maintain the effect........

    It's all starting to make sense now :D Thanks again for all the help :D

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