How do I make a ball grow

0 favourites
  • 4 posts
From the Asset Store
Minimalist Crash Balls is a game where the goal is to hit the ball on the portal, with 20 different levels :)
  • Hi everyone! I'm new to construct 2 (Just moved from GameSalad)

    I don't have any programing skills (designer student here) although i've learn a few things from GameSalad. I'm currently struggling with setting up a really basic thing. I keep having bugs/crashing the browser.... so i decided i'd just ask if someone could help me out!

    Me and my brother are trying to:

      • Create a ball from pressing the mouse left-button. (Mouse event on Left Clicked -> Create object at (Mouse.X,Mouse.Y))
      • Make it grow while the mouse button is being held. (Here is where the problems begin... perhaps something like this: While event/Mouse Left button down event -> - Set object size: Width = Width + 1/Height = Height +1. We want it to grow exponentially)
      • Make the ball stop growing if it reaches a specific size or the mouse button is released
      • When the mouse button is released the ball goes in a random direction and bounces in the edge of the layout (My brother tought in something like setting the object as a bullet, with bounce enabled, but the ball goes away unless we set a 'wall' sprite and then coding it to set angle of motion = random(360))

    I'm sorry this is probably a mess... but so is our head right now and we can't seem to figure this out...

    PS: He said he published a topic already but just in case he wasn't specific enough. Oh, and sorry for any english mistake I may have made!

    If you could help us I'd be really thankful!

  • Welcome to construct 2

    This is how I would go about the 1st part of your problem and I agree about setting up walls around the screen and giving the ball the bullet behaviour with bounce enabled.

    I am sure there are other/better ways of doing this.

    (Please ignore on the picture where it says press enter in the little blue box - it's just my voice recognition software been captured in the picture)

  • RamPackWobble

    Thank you Ram! It worked like a charm! In order to make it grow exponentially my brother ended up suggesting this, based on what you told us:

    Add (Self.ivSize < Self.ivMaxSize)*sqrt(Self.ivSize) to ivSize

    I also managed to make the balls go in a random direction with setting the bullet angle to random(360) but only enabling bullet behavior once the mouse button was released.

    I'm now working in making the balls bounce on the walls, for some reason they keep bouncing in non-intuitive directions

    ---

    alibest23 Thanks

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Check the shape of the collision polygon you've assigned to the ball. This is done in the image editor and it is the bottom icon on the left that looks like nodes connected with lines.

    In the bullet properties try setting the "set angle" to yes.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)