Constrain doesn't constrain
Hunnenkoenig
Member Posts: 1,173
I made an actor, which I want to move constantly as long as I touch the screen.
If actor touch pressed
constrain attribute self.Position.X to self.Position.X+5
That's all.
Now, if I touch it, it moves to X+5, then I have to release the touch and if I touch it again, it moves constantly, like I want it to move.
So it is beyond my mind, why the first time it only moves +5 and stops?
There is nothing else in the whole project, just this actor with this rule.
I think, it is a bug.
If actor touch pressed
constrain attribute self.Position.X to self.Position.X+5
That's all.
Now, if I touch it, it moves to X+5, then I have to release the touch and if I touch it again, it moves constantly, like I want it to move.
So it is beyond my mind, why the first time it only moves +5 and stops?
There is nothing else in the whole project, just this actor with this rule.
I think, it is a bug.
Comments
I assumed, that somebody will come up with this.
The problem is, my above post is only an example.
I don't want to use touch in my project at all, I just made this, to test, why my constrain doesn't work.
The finished project will move the actor by accelerometer, but to test teh functions, I built in keyboard and mouse functionality.
So, I need it so, that if I push a key on the keyboard, or touch the screen and hold it, it will move, without haveing to move the mouse.
I could have made the example too:
If actor key right down
constrain attribute self.Position.X to self.Position.X+5
The bug still exists.
Thanks anyway.
EDIT:
The timer solution makes my movement jerky as hell. Even if I use 0.01
I test it now in the gamesalad viewer and it works fine with accelerometer and constrain.
I made an endless doodlejump clone within one day. I just have to polish it further and add some features.
When it is on the appstore, I will upload the project for free use probably.
BTW: look out for our newly released game "Assault Commando", which is #50 in all games and 15 in arcade (apple messed up our release, so we are not in action until the update comes out)
Next game is developed with our own engine. Will be released hopefully in october.