rotating, destroying actor
Hey guys, i am making a puzzle game, where I have an actor rotating. When the actor rotates, if a certain side of it (mqrked by color) lands next to another. It destroys the actor. Is this possuble to do? It has to be a certain side, lining up with the correct color of another actor... how can this be done?
Comments
Say for example, that all actors have blue on the right border. If the actor is rotated to 0 then the blue side is on the right. If the actor is rotated to 90 then the blue side is facing up. If the actor is rotated to 180 then the blue side is facing left. And if the actor is rotated to 270 then the blue side is facing down.
When two actors collide, you would check to see if their angles of rotation are opposite. If they are opposite, then you know that the same side is touching.
(That make sense in my head! Does it work in practice!?!)
The only other way I can think of is to constrain colored actors to the sides of the shapes -- so that you could check to if certain colored actors are colliding.
Hmmm..... by "many shapes" do you mean different kinds of shapes? Or do you mean that there are many actors -- each with the same basic shape and color scheme, but with different starting rotations and positions? What does "many shapes" mean?
I was just paranoid spmeone would take my idea so i said as little as possible about my game xD
Constraing actors could work, only could i have them rotate in groups or if one rptates do i have to set it so they all rotate. Because i am going to have a lot of shapes, that would be a pain.
My idea is to have the triangle actor, then on each of the three edges put a small transparent actor along the side. So when that actor lines up with the one its identical to it destroys the actor..the question is can i get all the other transparent actors to stay and rotate with the triangle actor?
Thanks. Youve been a so helpful
In my head it goes something like this -- if two actors collide, subtract the rotation of one actor from the rotation of the other actor. If the answer = 180 then they are opposite (and therefore the same colored sides are touching).
My idea is to have the triangle actor, then on each of the three edges put a small transparent actor along the side. So when that actor lines up with the one its identical to it destroys the actor..the question is can i get all the other transparent actors to stay and rotate with the triangle actor?
On the other hand a simple subtraction upon collision is almost effortless for GameSalad.
on a side note, what is constraining an actor?
In addition, each constrain behavior would need to do some trig calculations.
Do you mean that each actor might be rotated differently? That is also true of any scene.
And yes, some actors might need to rotate more that others actors.
Puzzle pieces are supposed to move to different locations and rotate into different orientations. Some will be further away than others. Also, some will need to rotate more than others. This is what makes them puzzle pieces.
http://forums.gamesalad.com/discussion/38050/how-to-move-from-center-and-rotate-from-the-sides-with-touch-anyone-have-this-template