touch is pressed issue

kajutokajuto Member Posts: 314
edited June 2012 in Miscellaneous
hi there@!! recently I'm making a button when touch is pressed spawn 3 actor that goes up leaving some space between those 3 spawns actors. But i want when touch is pressed 2nd time goes back to the button position. so far, what i made is that when i touch that button spawns 3 actor goes up (okay) and i pressed again it keep coming out , and i put a timer after 5 second goes to that button position behind it.

Button code:

Rule: touch is pressed

1)spawn actor#1 *back of the actor
2)spawn actor#2 *back of the actor
3)spawn actor#3 *back of the actor

Spawn Actor code:

1) move to x=187 & y=220 relative to scene, speed 500
Timer: after 5 second run to completion, move to x=188 & y=44 relative to scene, speed 500 (that position is where the button is).
2) move to x= 187 & y=156 relative to scene, speed 500
Timer: after 5 second run to completion, move to x=187 & y=44 relative to scene, speed 500 (that position is where the button is).
3) move to x= 187 & y=92 relative to scene, speed 500
Timer: after 5 second run to completion, move to x=187 & y=44 relative to scene, speed 500 (that position is where the button is).

beside that, i want when touch is pressed 2nd time goes back to the button position, NOT when i keep touching it keeps coming out infinite time when i pressed because it keep respawning lol

Thanks in advance!!

Best Answers

  • ORBZORBZ Posts: 1,304
    Accepted Answer
    Sounds like you need a counter attribute to keep track of each time the button is pressed then make a rule based on the value of the counter attribute.
  • JustMe74JustMe74 Posts: 542
    Accepted Answer
    I'm not sure I understand what you're asking.

    Are you saying that this is what you want to happen:

    1). Press a button, and 3 actors are spawned
    2). Those three actors then move to a location
    3). After 5 seconds, the three actors move to another location
    4). If the user presses the button again, the actors all move back to where the button is located

    If that is what you're trying to do, then you could:

    1). Create an integer attribute "ButtonPressed" with a default value of 1
    2). Create a boolean attribute "MoveBack" with a default value of false
    3). Create a rule on the button that says when ButtonPressed is 1 and when Touch is Pressed, spawn the three actors, and change ButtonPressed to 2
    4). Create a rule on the button that says when ButtonPressed is 2 and when Touch is Pressed, change MoveBack to true and ButtonPressed to 1
    5). Create a rule on the actors that says when MoveBack is true, move them back to the position of the button, and then set MoveBack to False

    Hope that helps.
  • LumpAppsLumpApps Posts: 2,881
    Accepted Answer
    @kajuto Justme74 gave you an email address: ariel @ lintgames.com without the spaces ;)

Answers

  • kajutokajuto Member Posts: 314
    @ i tried what you did, but the Spawner actor keep spawning every time i pressed the button instead when i pressed the second time go back to the button position....

    The integer att "buttonPRessed" with default value of 1, you mean Game att or self. att?same for Boolean att "moveBack" default value.

    #3 and #4 i put it in the Spawner actor. For the #5 i put inside the moveObject ,
  • JustMe74JustMe74 Member, PRO Posts: 542
    Without seeing your rules it will be almost impossible to provide any more help.
  • kajutokajuto Member Posts: 314
    How can I post a image here? So I can post a screenshot for ya
  • kajutokajuto Member Posts: 314
    give me your email i can send u the file
  • JustMe74JustMe74 Member, PRO Posts: 542
    Sure. ariel at lintgames.com
  • kajutokajuto Member Posts: 314
    i can't send you the email to that link...can you give a email address?
  • kajutokajuto Member Posts: 314
    thanks LudwigHeijden lol i though he was telling his name loll
Sign In or Register to comment.