GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Constrain doesn't constrain

HunnenkoenigHunnenkoenig Posts: 1,173Member
edited November -1 in Tech Support
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.

Comments

  • RHRH Posts: 1,079Member
    I've got the same as you. Just tested it in a project.
  • HunnenkoenigHunnenkoenig Posts: 1,173Member
    Thanks Tshirt, but it is not useful for me.
    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
  • HunnenkoenigHunnenkoenig Posts: 1,173Member
    Ok, this may be a workaround, but this doesn't explain, why it works afterward and not for the first time.

    The bug still exists.

    Thanks anyway.

    EDIT:
    The timer solution makes my movement jerky as hell. Even if I use 0.01
  • victorkin11victorkin11 Posts: 251Member
    I remember that in the release note, it have said that the constrain behave can't do this as the old version!
  • BarkBarkCoBarkBarkCo Posts: 1,400Member
    @Hunn, For the timer based solution, you'll need to use interpolate for the movement w/no easing. Just set the interpolate to take a little longer than the timer's frequency, that way it will never complete.
  • HunnenkoenigHunnenkoenig Posts: 1,173Member
    Thank you for the answers.

    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)
  • BarkBarkCoBarkBarkCo Posts: 1,400Member
    Cool! Do you mind if I ask what you guys used to develop "Assault Commando"?
  • HunnenkoenigHunnenkoenig Posts: 1,173Member
    It was developed with Unity.

    Next game is developed with our own engine. Will be released hopefully in october.
This discussion has been closed.