How do I make a ball grow

Get help using Construct 2

Post » Wed Nov 11, 2015 3:48 am

Hi everyone! I'm new to construct 2 (Just moved from GameSalad) :D

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! :)
B
7
S
1
Posts: 16
Reputation: 464

Post » Wed Nov 11, 2015 8:29 am

Welcome to construct 2

Image

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)
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Wed Nov 11, 2015 2:38 pm

@RamPackWobble

Thank you Ram! It worked like a charm! :P 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 :cry: :cry: :cry:

---

@alibest23 Thanks :D
B
7
S
1
Posts: 16
Reputation: 464

Post » Wed Nov 11, 2015 4:03 pm

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.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832


Return to How do I....?

Who is online

Users browsing this forum: Apollo14, ChoosyZerk and 57 guests