How do I Create explosions on random parts of object

Get help using Construct 2

Post » Wed Mar 04, 2015 1:39 pm

so i have a object - let's say it's a huuuge box.

it's collision is a square. now if i hit from the left with bullet it will hit "on collision with .. spawn explosion.. bla bla" , that explosion explodes exactly where it was hit. If i do it from up, left or bottom, same thing.

how can i make that explosion appear randomly inside that square? (or prolong a few milliseconds of bullet flight and then destroy it - causing random explosion)
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
41
S
14
G
12
Posts: 623
Reputation: 9,359

Post » Wed Mar 04, 2015 1:53 pm

You could mess around with events, but this behaviour is just perfect for that sort of thing: behavior-emitter_t122856
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Wed Mar 04, 2015 2:20 pm

that looks pretty good for spawning random, but what if i want my bullet to fly a bit more... ? i've attached a picture as example.
You do not have the required permissions to view the files attached to this post.
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
41
S
14
G
12
Posts: 623
Reputation: 9,359

Post » Wed Mar 04, 2015 2:22 pm

There are many ways one can do that.
Last edited by Lordshiva1948 on Wed Mar 04, 2015 2:25 pm, edited 1 time in total.
B
245
S
37
G
15
Posts: 1,940
Reputation: 40,094

Post » Wed Mar 04, 2015 2:22 pm

Give your bullet some sort of a life gauge instance variable and subtract from it when overlapping the object it hits. Spawn explosions every .x seconds, destroy bullet when it's life is over or under a limit.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Post » Wed Mar 04, 2015 2:29 pm

Try this demo
You do not have the required permissions to view the files attached to this post.
B
245
S
37
G
15
Posts: 1,940
Reputation: 40,094

Post » Wed Mar 04, 2015 4:10 pm

An unnecessary overly complicated example capx, but perhaps it can provide you with some ideas...
You do not have the required permissions to view the files attached to this post.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Wed Mar 04, 2015 4:26 pm

thnx guys, i will try somebodys idea, i can't try your capx's because i use only stable constructs (r195 atm), but i will check them out when next stable (probably r200) is out.


@Somebody - i need that value to be random - if my sprite is x in length and y in height, how can i get a random value for the duration of bullet not to fly outside on the other side and stop inside that sprite? (i need it randomly, your timer should work, but how do i determine timer's range of values? (from x,y and bullet speed)? )
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
41
S
14
G
12
Posts: 623
Reputation: 9,359

Post » Wed Mar 04, 2015 8:16 pm

@saiyadjin m you can always open a capx with an older build if you fiddle with the caproj file. To do that you need to:

1) unrar a capx file to its components (each capx is actually a zipped project folder structure).
2) Open the caproj file with a text editor
3) Find the <saved-with-version>19800</saved-with-version> field and change the 5 digit number accordingly (for version r195 type 19500)
4) save the caproj and run it. It should open just fine, unless some feature that was introduced on a later version is being used.
composer - multimedia artist
www.eli0s.com/en/
B
68
S
26
G
4
Posts: 1,146
Reputation: 9,649

Post » Wed Mar 04, 2015 9:32 pm

didn't know that, thanx :)

edit: both examples are exactly what i needed, thank you guys!
Sea Monsters template - Isometric
Also includes 40 pages PDF of optimizations and "how-to" for your games, and how the "sea monsters" template was built. Follow link for details :)

sea-monsters-templates-and-assets_t162705
B
41
S
14
G
12
Posts: 623
Reputation: 9,359


Return to How do I....?

Who is online

Users browsing this forum: ksiads, tarek2 and 6 guests