Rotate to mouse position help!

Hi! I'm new to GameSalad so I apologize if I posted this somewhere where I'm not supposed to!

I'm trying to make a game [currently just a test room] which allows the player to:
Control the actor using the keyboard and
Use their mouse to rotate the actor and shoot at where the mouse has clicked [Which means Aim&Shoot using the mouse]

I have tried: "if mouse is down > change attribute self.rotation to vectorToAngle(mouse.x-self.position.x, mouse.y-self.position.y)" and made the actor able to Control Camera [there is no other actors able to control camera]

Only to face a problem:
Once the player leaves the default given region of 480*320 [ I'm referring to the area which you were given before manually resizing the map. The current size for this test room is 1440*400], it starts spinning non stop.
[If this helps, I'm using Windows version of Game Salad.
Here's my map if you don't understand what do I mean. http://www.mediafire.com/?2znr9axznw55upk]

Is there a way to prevent it from spinning without changing the Game attribute's display size?

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You could add an actor in the background that is the size of the scene (or test room) and is hidden (self.color.alpha=0) and give it the following rule:

    If mouse position is inside
    .....change attribute game.allowRotation to true
    Else
    .....change attribute game.allowRotation to false

    And then add the following condition to the rule you posted above:
    If [all conditions] attribute game.allowRotation is true

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • WindKazeWindKaze Member Posts: 5
    Hi! Tatiang, thank you for responding to my post. [and sorry for replying so late]
    I have done what you have said, but it seems like the problem is not solved, I am the player is still spinning in circles once he leaves the area.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Works perfectly for me (see attached).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • WindKazeWindKaze Member Posts: 5
    edited January 2013
    I'm unable to load the scenes of the file which you have attached [Unzipped and placed at where I usually store my GameSalad files]
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Are you using Mac Creator or Windows Creator? What happens when you try to preview the game? Or can you not even open the file?

    Can you post a screenshot of the rules you're using for your background actor and for your player actor?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,881
    @WindKaze Follow this discussion and all your fondest dreams will come true:
    http://forums.gamesalad.com/discussion/42754/problem-with-vectortoangle-and-camera
  • WindKazeWindKaze Member Posts: 5
    Are you using Mac Creator or Windows Creator? What happens when you try to preview the game? Or can you not even open the file? Can you post a screenshot of the rules you're using for your background actor and for your player actor?
    I'm using a Windows Creator, when I try to preview the game, it shows a grey page and states that the Scene does not exist. I can open the file, but upon previewing the game, all that it is shown is like the usual preview settings, except without scenes on the bottom left and without image in the center. [Vid (I have no idea why am I responding slowly just now): ]

    as for the second question, I'll post it around 8 hours later (from thie post. 6:23AM +8GMT) [sorry!]...I need to go off for school now


    http://www.mediafire.com/?zyykbu498r0sro2
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Yep, if you're trying to open a Mac file in Windows, you're going to have problems. I suggest you refer to the link RThurman posted above.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • WindKazeWindKaze Member Posts: 5
    Thanks tatiang!
    Thanks RThurman!
    The error seems to have fixed now!
Sign In or Register to comment.