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 Posts: 18Member
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 Posts: 360Member
    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 Posts: 2,402Member
    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 Posts: 18Member
    i try to make something like a pong; and use touch to move the player, in X line(portrait format),
  • ToastKittenToastKitten Posts: 360Member
    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 Posts: 4,047Member, Sous Chef
    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 Posts: 18Member
    AHHHH MULEKEEE, thanks.
  • iLITEiLITE Posts: 18Member
    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 Posts: 4,047Member, Sous Chef
    When you constrain it overrides the physics so it will not collide with blocks properly.
This discussion has been closed.