Rotate to mouse position help!
WindKaze
Member Posts: 5
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?
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
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
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.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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
http://forums.gamesalad.com/discussion/42754/problem-with-vectortoangle-and-camera
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
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Thanks RThurman!
The error seems to have fixed now!