How do I rotate sprite without affecting collision box?

  • I'd like to rotate back and forth in a ping-pong loop, just like LiteTween does without the collision box getting rotated.

  • You could use a invisible sprite that don't rotate to be your object with the colision points and then add another sprite with the image you like on top of it, using the pin behaviour and to be the rotatory one. All the colision actions must be refered to the invisible sprite.

  • The trouble is I don't want to use double s as it will be for an enemy and that would cause massive headaches for the multiple instances. Is there a shader that could do this?

  • Why would it cause massive headaches?

    Just put the two objects in a container..

  • Because the enemies would need containers for every instance of themselves, and they would need to be pinned to their animations?

  • Still don't know what the issue would be..

    One click in the editor - add to container..

  • How would I create containers for multiple enemies though? Would I have to place them behind the animation sprites for each one?

  • I always create sprites through events instead of in the editor, but If there are the same amount of enemies as there are collision boxes ther shouldn't be an issue..

    Example

  • So it automatically selects a box if there are multiples? Is there a benefit to creating sprites via the event editor?

  • So it automatically selects a box if there are multiples? Is there a benefit to creating sprites via the event editor?

    A container creates all it's contents on created, it will first use what is on the layout..

    (Try removing two of the yellow sprites in the editor and run the program again, it will still look the same..)

    I guess it depends on what kind of game you sre making and what you are used to..

  • Also, what happens about, say, mirroring the animations when the collision changes direction? Does the engine know which enemy animation to mirror?

    Here's the problem I'm having: https://www.dropbox.com/s/wuz5t8ixdgq6dle/fraug2.capx?dl=0

  • Also, what happens about, say, mirroring the animations when the collision changes direction? Does the engine know which enemy animation to mirror?

    Here's the problem I'm having: https://www.dropbox.com/s/wuz5t8ixdgq6dle/fraug2.capx?dl=0

    Add the frog and the frogcontainer to a container and it works..

    At the moment you aren't telling the program which frogcontainer belongs to which frog..

    Look at

    How events work

    and specifically the unreferenced objects part of that page..

    Using a container is one way to automatically pick the right object, other ways would be giving one of them a variable set to the uid of the other, or things like pick nearest as you tried before..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've not used containers before, sorry if I seem a little helpless! Is it possible, using the example I've given, to convert the enemy animations and containers to a container so this works? So far, my main character is just pinned to it's container, and that was how I was doing this.

    EDIT: Creating a container

    To add an object to a container, select one of the objects you want in the container and click the Create link in its properties (which appears under the Container category next to the label No container). A dialog opens allowing you to choose the object to add to the container.

    Seems to work!

  • Like I said add container and it works...

    right click either the frog or the frogcontainer, go to the properties bar and underneath effect you find container..

    Add to container and select the other object..

    Ready!!

    You could have also found this in the manual

    (BTW: the reason I often link to the manual is because many people don't read it and it's actually quite usefull when you want to know how things work)

  • So far, my main character is just pinned to it's container, and that was how I was doing this.

    Problem is, you didn't reference/pick any object in your action/event so they weren't always pinned to the right one..

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