Constrain rotation problem + Collisions not reacting to expressions
acrotty
Member Posts: 0
Hi,
I am new to Gamesalad and this is my first post. Normally I can just solve the problem through videos and tutorials but this has me stumped...
Attached is what I want to happen in my game.
https://docs.google.com/document/d/1RJ0tMvjciHfVumBluxYMfowhafekUZIXlv0jsZ0qLEw/edit?usp=sharing
The expression I used is to constrain the x , y, and angle of the main character to another actor called anchor point. I have got the two linked and when left or right key is down the character will rotate, but there is nothing stopping the character from rotating 360 degrees, plus collisions on the walls don't seem to stop the character moving through them?
Expressions used
Attributes
HeroX:integer
HeroY:integer
Angle:angle
Player
Constrain: self.position.y to: game.HeroY+40*sin (game.Angle +40)
Constrain: self.position.y to: game.HeroX+40*cos (game.Angle +40)
Constrain: Self.rotation to game.Angle
Anchorpoint (actor)
Constrain: game.HeroX to: self.position.x
Constrain: game.HeroY to: self.position.y
Constrain: game.Angle to: Self.rotation
Can anyone help me understand why the collisions are not working, or how I can control the rotation by rotating to a set degree either left or right around the anchor point....or better still is there an easier way I have overlooked to perform the same action. (Preferably one that does not involve trig).
Thanks,
Andy
I am new to Gamesalad and this is my first post. Normally I can just solve the problem through videos and tutorials but this has me stumped...
Attached is what I want to happen in my game.
https://docs.google.com/document/d/1RJ0tMvjciHfVumBluxYMfowhafekUZIXlv0jsZ0qLEw/edit?usp=sharing
The expression I used is to constrain the x , y, and angle of the main character to another actor called anchor point. I have got the two linked and when left or right key is down the character will rotate, but there is nothing stopping the character from rotating 360 degrees, plus collisions on the walls don't seem to stop the character moving through them?
Expressions used
Attributes
HeroX:integer
HeroY:integer
Angle:angle
Player
Constrain: self.position.y to: game.HeroY+40*sin (game.Angle +40)
Constrain: self.position.y to: game.HeroX+40*cos (game.Angle +40)
Constrain: Self.rotation to game.Angle
Anchorpoint (actor)
Constrain: game.HeroX to: self.position.x
Constrain: game.HeroY to: self.position.y
Constrain: game.Angle to: Self.rotation
Can anyone help me understand why the collisions are not working, or how I can control the rotation by rotating to a set degree either left or right around the anchor point....or better still is there an easier way I have overlooked to perform the same action. (Preferably one that does not involve trig).
Thanks,
Andy