How do I Rotate an Object and have it move toward player?

0 favourites
  • 7 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • I am very new to Scirra so I am sure my process is not the same as every one but this makes sense to me...sort of

    I am working on a rotational shooter from a Udemy class I am taking and I wanted to add an object that moves toward the player and rotates at the same time.

    The enemies6 itself has 6 animation panes but I am not using this to achieve the rotation but to have 6 different sprites to provide variety in the enemies that appear on I am hoping that is not the only way to do a rotation and move.

    In short when I use this the object rotates in a big circle I am sure this is an easy fix...hopefully

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If I understand correctly, you want the enemies to face the player and than chase him?

    My favorite way of doing this is giving the enemy both the Turret and Bullet behaviors. The Turret will handle rotation and Bullet will give its speed. Perhaps the coolest thing about this method is that you can give the enemies sort of an "awareness area" by changing the Range propriety in Turret.

    And then you can have some other events to enable or disable Bullet, to make it stop when it reaches the player, for instance. ... chase.capx

  • With my ships they are facing the player and those are working fine, but I am not having them rotate at all. The asteroid objects I want to rotate to give them a bit more life, but I only what them to spin slightly....where is with my above settings the go a full 360 degrees like an orbit cycle....not a spin...if that makes sense.

    I will give your suggestion a try and see what I can figure out. As for stopping the bullet I would just set that up in the destroy event with either the player or laser objects.

  • Oh, I think I get now.

    If you want the object to spin around itself, independent of it's moving angle, you'll have to use "Move at angle" instead of "Move forward". Like this:

    Then the object will always move toward the player, no matter where it's facing.

    Also, remember to use Delta-time

  • Very cool...i'll give this a try!

  • Gave it a try but this just causes the asteroid objects to come toward player, which is fine. But the asteroids are still not spinning I am sure I am missing something.

  • Figured this out. Along with your trick I needed to add a point of origin for the sprites. I assumed it was the center on creation, but apparently not. I think I am good now.

    Thanks for the info!

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