GameSalad

Howdy, Stranger!

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

help with touches move

iLITEiLITE Member Posts: 18
edited November -1 in News from the Dev Team
i a noob, i try to make a actor moves with touch, but the actor move only the same position, i need to move a actor in a line, like a pong, but using touch movement.
i try to find a template,but i not found.
sorry , i dont speak inglish e the google tradutor is my god.
Thanks!

Comments

  • ToastKittenToastKitten Member Posts: 360
    could you try and be more specific? I know it's hard on the translation to show what you want, but I can't understand what you mean by your post.

    Hope I can help!
  • Rob2Rob2 Member Posts: 2,402
    Maybe something like this from Orbz http://gamesalad.com/game/play/79272 it is set to work with mouse but will work with touch too.
  • iLITEiLITE Member Posts: 18
    i try to make something like a pong; and use touch to move the player, in X line(portrait format),
  • ToastKittenToastKitten Member Posts: 360
    Create a boolean called "isTouched"

    Create a rule
    -if actor receives event - touch - pressed
    -- change attribute self.isTouched to true
    OTHERWISE
    -- change attribute self.isTouched to false

    Create a Timer: every - 0
    Create a rule INSIDE that timer
    - if self.isTouched is True & if game.Touches > 0
    --change attribute: self.Position.X = game.Touches.Touch 1.X

    hope this helps!

    EDIT: due to scitune's post, used the otherwise function to allow for only 1 rule. Kudos scitunes!
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    here's what I would do:

    constrain self.positionY to where ever you want the pong actor to be positioned

    if touch is pressed change self.isTouched to true
    OTHERWISE change self.isTouched to False

    Rule when self.isTouched is true
    constrain self.position.X to game.touch1.x
  • iLITEiLITE Member Posts: 18
    AHHHH MULEKEEE, thanks.
  • iLITEiLITE Member Posts: 18
    hum ok ok, but i try to insert colid with blocks and dont work, is like a kind of a bug,
    i put colide with walls, and the actor, make a weird loop
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    When you constrain it overrides the physics so it will not collide with blocks properly.
This discussion has been closed.