Actor rotation error, 2 player cannon
Okysho
Member Posts: 158
Hey guys. I've taken a break from my megaman magnum opus to do a quick snacky two player cannon-based game.
I seem to have some trouble with the rotation of the second player's cannon. It has the same rotation attributes as player one.
So far this works pretty well in a testing environment, but when I enhance the scene size, suddenly the rotation of player 2, (positioned in the bottom right corner) is restricted to about 20 degrees. I have no idea why this is happening. Any thoughts?
My rotate to angle behaviour has the following:
Angel: vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y ) Relative to actor
Speed 200, run to completion (yes), stops on destination (no)
I seem to have some trouble with the rotation of the second player's cannon. It has the same rotation attributes as player one.
So far this works pretty well in a testing environment, but when I enhance the scene size, suddenly the rotation of player 2, (positioned in the bottom right corner) is restricted to about 20 degrees. I have no idea why this is happening. Any thoughts?
My rotate to angle behaviour has the following:
Angel: vectorToAngle( game.Mouse.Position.X - self.Position.X , game.Mouse.Position.Y - self.Position.Y ) Relative to actor
Speed 200, run to completion (yes), stops on destination (no)
Comments
The second player won't turn based on where I move the mouse, and it only rotates approximately 20 degrees in either direction.
I tried changing the relativity from actor to scene that didn't make any difference...
Is there some sort of invisible rotation point on the stage?
Are your cannons on a scrollable layer?
What it may be is that your mouse position is being recorded as relative to the origin of the camera(bottom right corner of the camera)
If thats the case, try this, vectortoangle(game.mouse.position.x+game.camera.origin.x-self.position.x,"same thing for y")
I'm on my iPhone so forgive my shorthand.
Also, u can try self.x-mousepos+camorigin
I can't remember if the cam origin is available as a game attribute, but if it isn't, just make an unlocked actor in your scene and a new attribute called cam.origin.x and constrain that to the scene cam origin.
Do the same for y as well.
Here a link to the teaser of my game, if u watch the video, I'll see that I use a lot of rotations. My bullets aren't spawned either, they are all recycled. That required a lot of rotation stuff as well.
Let me know if there is anything in there that seems to fit what you need.
What's perplexing to me the most is that it just isn't working when another actor with the same behaviour is working. It's hard to explain the bizzare essence of the problem without publishing what I've got so far
Screenshot the rules, and the layers
Video the game in action
Then maybe I can help a bit more
really quickly I go through how I've set up the stage. Inside the camera frame is the origin actor. and there's P1 on the left and P2 on the right. the camera control switches between the two after firing their... projectiles. P2 starts first, you can see it's got poor range of motion. I don't know how to fix it.