Sprite that disappears and reappears randomly

Get help using Construct 2

Post » Tue Feb 11, 2014 10:59 am

I want to make a sprite disappear and reappear multiple times in completely in-boarder areas across the screen, anyone can help with this?
B
6
S
1
Posts: 89
Reputation: 619

Post » Tue Feb 11, 2014 12:15 pm

Add hiddin sprites on the potential locations you want the image to appear. Lets call them spawners. The object to appear, objectX.


Have an event run every X seconds as desired, and use it to destroy and spawn a new objectX.

event: every 2 seconds - action: destroy objectX

subevent to every 2 seconds:
event: system, pick random spawners - action: object spawners spawn objectX at image point 0.

Every 2 seconds the objectX gets deestroyed and spawned on a new random picked spawn point.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Tue Feb 11, 2014 2:23 pm

Is this any good to you ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Fri Feb 14, 2014 2:49 am

Hey I understood the second part very well but I couldn't quite understand the first part could you elaborate to me by any chance? Thanks
B
6
S
1
Posts: 89
Reputation: 619

Post » Fri Feb 14, 2014 8:47 am



for example

I call a function with a set of x and y coordinates (0,10,45,67) (upper left x,upper left y, lower right x, lower right y) would be a rectangle with (0,10) as upper left and (45,67) as lower right.

these are sent as "0104567"

in the function ("fcCreateSpriteInArea") I find the x and y positions using "tokenat"

(from the manual - "tokenat(src, index, separator)
Return the Nth token from src, splitting the string by separator. For example, tokenat("apples|oranges|bananas", 1, "|") returns oranges.")

so now all I need to do is create sprite at (random (x1,x1)),random(y1,y2)

I also called the function with choose("00540100","5400640380","0100100380","0380640480")

so the choose just picks 1 of the 4 rectangle coordinates I want to create a sprite in

I also used fade to make the sprites fade in pause and fade out (to destroy)

Clear as mud ?

any questions please use @RamPackWobble as I will get a message to reply

Good luckRamPackWobble2014-02-14 08:49:13
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Sat Feb 15, 2014 5:13 am

@RamPackWobble Hey man, thanks a lot of going through the trouble of explaining all of this to me, I`m new to this whole construct scene and ive really been enjoying learning and everything but im still having some trouble understanding everything, when you say lvRectangleXandY what is that exactly, is that in itself a function, i find it easier to teach myself, if you could send me the capx it would be great, Thanks!Slicksz2014-02-15 05:17:22
B
6
S
1
Posts: 89
Reputation: 619

Post » Sat Feb 15, 2014 6:48 am

The capx is the one in my first post in this thread.

edit (caps to capx - stupid auto correct !)RamPackWobble2014-02-15 07:12:45
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Sat Feb 15, 2014 7:00 am

oh, the this, aiight thanks a lot
B
6
S
1
Posts: 89
Reputation: 619

Post » Sat Feb 15, 2014 7:17 am

lvRectangleX&Y is just a local variable to store the choose in.

& I've only just realised that when you asked, "Hey I understood the second part very well but I couldn't quite understand the first part could you elaborate to me by any chance? Thanks." you were not talking to me then ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Sat Feb 15, 2014 8:16 am

@RamPackWobble
That's how I would do it
randomAreaOfSpawn.capx
This way you don't need to maintain a cumbersome list of strings of bounding boxes
Last edited by Yann on Sun Sep 14, 2014 7:12 pm, edited 1 time in total.
B
66
S
22
G
14
Posts: 1,484
Reputation: 16,511

Next

Return to How do I....?

Who is online

Users browsing this forum: jbr190 and 37 guests