Multiple balls?

Get help using Construct 2

Post » Sat Oct 03, 2015 6:15 pm

Hello,

I'm working on a simple game where you shoot a ball up the screen and it bounces of various objects and lands in one of several scoring slots. its working okay but I now want to add multiple balls, not at the same time, but lets say you have 10 balls and once you fire ball 1 and it comes to rest in a slot, it stays there and you get ball 2 to shoot.

I know I could do this by copy/pasting all the events for ball1 10 times. but thats a very poor way of doing it I suspect. there will be a very simple way to go this I know of it. but I don't know how.

if someone could give me a little hint on how to do it, that would be super.
B
6
S
1
Posts: 73
Reputation: 556

Post » Sat Oct 03, 2015 7:46 pm

Perhaps, apply the event to an "Active" ball.

Set a boolean on the object called active, and set it to true when shooting with it.

Once its in a hole, set the boolean to false. Then next ball gets the boolean to true etc etc
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,572

Post » Sat Oct 03, 2015 11:21 pm

must have physics behavior, even if its a bouncing bullet to stop.... use the "Is Sleeping" event for the objects physics

add global variables "reload"+"count" , a ball instant boolean, and a variable "stop"

Is Sleeping : set ball boolean true

while ball on layout , "stop" =0 :
-------- boolean = false :
-------- boolean = true : +1 to GV"count" +1 to "stop"

GV"count"=GV"balls" : set reload to 0

Reload = 0 : spawn ball position x,y, +1 to GV"balls", set reload to 1

this should keep a track of whats on the stage, and you can easily have the "count" shown in a text box... if your thinking of 300 balls
B
9
S
3
Posts: 102
Reputation: 987

Post » Sun Oct 04, 2015 1:24 am

Thanks to both of you, I think this is a bit over my head atm so I'm going to file this game and come back to it at a later date when I understand more of C2.

Thanks though, much appreciated.
B
6
S
1
Posts: 73
Reputation: 556

Post » Sun Oct 04, 2015 11:48 am

here's a simple way of doing it:
https://dl.dropboxusercontent.com/u/523 ... aunch.capx

btw what game is that in your avatar? looks familiar (spectrum?)
B
27
S
12
G
1
Posts: 157
Reputation: 3,359

Post » Sun Oct 04, 2015 1:12 pm

Oh thank you very much I'll check that out when I'm on my PC later :)

The game is called Mazogs and it was on the ZX81 which is the ZX Spectrums daddy ;)
There was a Spectrum version called Maziacs which was looked better then the ZX81 version but wasn't as much fun.
B
6
S
1
Posts: 73
Reputation: 556

Post » Sun Oct 04, 2015 7:25 pm

mattb wrote:here's a simple way of doing it:btw what game is that in your avatar? looks familiar (spectrum?)



Sadly it won't load :(
Says I'm using an older version of the software.. I'm on 212
B
6
S
1
Posts: 73
Reputation: 556


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, ignaciosimo, nickar and 42 guests