How do I spawn items at selected places?

Get help using Construct 2

Post » Thu May 14, 2015 9:07 am

Hello everybody I'm making a survival based game. I was wondering how do I spawn object in certain positions?
For example I made placed several boxes on the start of layout, what do I need to do to make:
When box destroyed spawn random Item?

I have been searching on forums but didn't find what I needed :(
Thank you for listening!
B
8
S
3
Posts: 120
Reputation: 989

Post » Thu May 14, 2015 9:15 am

box on destroyed
> box spawn item at imagepoint

If you want to create something anywhere on the layout

box on destroyed
> system create item at x,y
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 14, 2015 9:35 am

@LittleStain But If I have 5 Item: 1 2 3 4 5
Do I make:
On Box destroy - create random? How do I make it choose 1 out of 5 items?
B
8
S
3
Posts: 120
Reputation: 989

Post » Thu May 14, 2015 9:42 am

There are many ways..

One would be to put the items in a family - a create family would take a random item from the family

Another way would be having a variable and setting it to choose(1,2,3,4,5) if all of them have equal oppurtunity to be created

So:
on box destroyed
> set variable to choose(1,2,3,4,5)
--- if variable = 1
> create item 1
--- if variable = 2
> create item 2
--- if variable = 3
> create item 3
etcetera
-- variable
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 14, 2015 9:56 am

@LittleStain by choose you mean going to the : System - Pick_random_instance? then what?
Or it's something else? I'm a beginner sorry..
B
8
S
3
Posts: 120
Reputation: 989

Post » Thu May 14, 2015 10:04 am

in the text-entry box after choosing set variable type : choose(1,2,3,4,5)

Image
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu May 14, 2015 10:46 am

@LittleStain Where did you add that Veriable 1 on your image?

here is what I got - .filedropper.com/untitled-2_1
Event sheet - i57.tinypic.com/9jj709.png
B
8
S
3
Posts: 120
Reputation: 989

Post » Thu May 14, 2015 11:37 am

Variable1 is just a global variable, like your Box and Box_Health..

The action is "system set value"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: dand, mageekm, oosyrag and 26 guests