0 Favourites

Multiple balls?

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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

  • 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

  • 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.

  • 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?)

  • 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.

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Isometric multiple floors
74 9,722
eleanorawesome's avatar
eleanorawesome
Unread hot topic
38 3,416
alextro's avatar
alextro
Unread hot topic
0 Favourites
[EFFECT] Multiple FX
46 8,061
Fenix18's avatar
Fenix18