Tshirtbooth onscreen control help with your template

hi
how are you tshirtbooth. i have recently added onscreen controls to my game which has worked very well and has worked. but when i came to adding the constraints like you did for me into my game with the onscreen controls the constraint does not work. it only works when i am moving left. but not right, up or down. please can you help. i need your help.
how are you tshirtbooth. i have recently added onscreen controls to my game which has worked very well and has worked. but when i came to adding the constraints like you did for me into my game with the onscreen controls the constraint does not work. it only works when i am moving left. but not right, up or down. please can you help. i need your help.
This discussion has been closed.
Comments
rule
actor receives event, touch, is pressed
(change attribute)
game.up to 1 (game.up is an integer)
rule
actor receives event, touch is released
(change attribute)
change attribute game.up to 0
Actor which moves when arrow buttons are pressed
rule
attribute game.up = 1
move direction 90 at a speed of 150
THIS IS BASICALLY THE SAME FOR ALL DIRECTIONS AND ARROW BUTTONS.
The bar actor (which is constrained to the actor which moves)
group
(change attribute)
self.innit.angle to vectorToAngle( self.Position.X - game.HeroX , self.Position.Y - game.HeroY )
(change atrribute)
self.init rotation to self rotation
(constrain attribute)
self.rotation to game.herorotation + self.initrotation
(constrain attribute)
self.distancefrom to magnitude( self.Position.X - game.HeroX , self.Position.Y - game.HeroY )
(constrain attribute)
self.position.x to game.HeroX +cos( self.Init Angle + game.HeroRotation )* self.Distancefrom
(constrain attribute)
self.position.y to game.HeroY +sin( self.Init Angle + game.HeroRotation )* self.Distancefrom
rule
actor receives event touch is pressed
(constrain attribute)
self.position.x to game.mouse.position.x
(constrain attribute)
self.position.y to game,mouse.position.y
(constrain attribute)
self.position.x to game.herox
(constrain attribute)
self.positio.y to game.heroy
(THE TRIANGLE ACTOR) and( THE ACTOR WHICH MOVES WHEN ARROWS ARE PRSSED) this is the actor which the bar is constrained
(constrain attribute)
game.herox to self.postion.x
(constrain attribute)
game.heroy to self.position.y
(constrain attribute)
game.herorotation to selfrotation
thank you for helping and by the way the capitals is so you can understand it more thank you
I will say this, if some one asks you for code, and you write:
THIS IS BASICALLY THE SAME FOR ALL DIRECTIONS AND ARROW BUTTONS.
has no meaning to anyone. "Basically the same but different" says to me a monkey magically typed random stuff while you were sleeping and we'll never know what it was, or why your code doesn't work.
I'm going to offer you a bit of insight on how I solve anything that needs rotation:
Sohcahtoa. That crazy ass indian saves me every time. Draw a picture of a vector coming from your X/Y axis, label theta under the vector, stuff an arc to show it's an angle, and use sohcahtoa.