Actor rotation error, 2 player cannon

OkyshoOkysho Member Posts: 158
edited December 2011 in Working with GS (Mac)
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)

Comments

  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    Try +360. After your formula. Try relative to scene
  • OkyshoOkysho Member Posts: 158
    adding +360 doesn't do anything. I didn't expect it to either... maybe I didn't explain the problem properly.
    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...
  • OkyshoOkysho Member Posts: 158
    Ok, after a bit of extra testing, I found that both cannons work when they're within the same camera frame, but also if either of they player cannons (P1 or P2) are moved to the right of where the initial frame is, then they'll both have strange rotations.

    Is there some sort of invisible rotation point on the stage?
  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    Are your levels bigger than the camera?

    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.
  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    Also, the +360 is so that if you are rotating clockwise past 0 deg. That it doesn't try and rotate the long way counter clockwise.
  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    http://forums.gamesalad.com/discussion/35582/cp-tanks-teaser#Item_6

    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.
  • OkyshoOkysho Member Posts: 158
    To answer your first question, yes my level is bigger than the camera. Think Angry birds, except now the piggys shoot back. I can't manually duplicate the second player's cannon to follow the mouse. I tried your suggestion and it still didn't work, although it did raise the overall starting angle, the actual angle of rotation did not.

    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
  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    Screenshots and video could be helpful.

    Screenshot the rules, and the layers

    Video the game in action

    Then maybe I can help a bit more
  • OkyshoOkysho Member Posts: 158
    There we go... that took a lot longer than it should have...



    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.
  • OkyshoOkysho Member Posts: 158
    Just sent it, sorry that took a little bit, for some reason G-mail doesn't like it when I try to upload GS files...
  • mu-kowAPPSmu-kowAPPS Member Posts: 233
    what was the problem?
  • sanderboy978sanderboy978 Member Posts: 1
    got it! fixed it! glad i could help

    :)

    Hello tshirtbooth, I have the same problem can you send me an email with instructions how to fix it?
Sign In or Register to comment.