Create same object on mouse click and destroy

Get help using Construct 2

Post » Sat Jul 06, 2013 1:23 am

Hello guys,

I want that when the user clicks on screen, the game get the X, Y coords and create a objectA at that position and start counting 10 seconds. At the same time the user clicks on another part of the screen and it creates the exact same object but with the time back to 0 and both of them are destroy at different times.

just like a Farmville game, you plant 1 banana and 10 secs later another banana. Banana 1 will be ready to harvest 10 seconds earlier than banana 2.

ty
B
7
S
1
Posts: 21
Reputation: 647

Post » Sat Jul 06, 2013 1:31 am

use mouse plugin on click and add the timer behavior to the object

on click- create object
          start timer 10sec "killme"

on timer "killme" > destroy object
ImageImage
B
70
S
21
G
7
Posts: 827
Reputation: 10,052

Post » Sat Jul 06, 2013 2:33 am

I used rex timeline and couldn't get it to work. Any other way to do it? :)

Or maybe a step by step tutorial in timer behaviors?

TY
B
7
S
1
Posts: 21
Reputation: 647

Post » Sat Jul 06, 2013 4:29 am

no need for plugins.

behaviors:
Mouse

Event sheet:
On click - function: spawnBanana

FunctionSpawnBanana
spawn spriteBananaObject at set X:mouse.X, set Y:mouse.Y
System: Wait: 10 seconds
Destroy spriteBananaObject
B
18
S
5
G
4
Posts: 568
Reputation: 5,079

Post » Sat Jul 06, 2013 3:29 pm

It worked with the second option. Thanks
B
7
S
1
Posts: 21
Reputation: 647

Post » Mon Jul 08, 2013 2:19 pm

@ratedam (y)
B
18
S
5
G
4
Posts: 568
Reputation: 5,079


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 2 guests