My Ball Stops Bouncing!!!
froamer
Member Posts: 29
.....pause for usual jokes............
..........
OK, my game is at the "proof of concept" stage, but I am pleased with my idea - now if only I could implement it ;-)
I have a ball that constantly bounces vertically. The idea is you guide it through a maze, timing the bounces to survive.
The problem is if my ball hits the walls on the corners it slows down or even stops bouncing altogether.
As you scroll the background, the camera is moved through the scene. To keep the ball in the picture I constrain its X position...
self.Position.X = scene.Camera.Origin.X +100
I think it's this that is making the ball go inside the walls which stops it bouncing; I think.
There are a couple of solutions I can think of..
1) Only adjust the X position if the ball is not colliding - is there a way to do this?
2) Force the ball to keep its speed in some way, so if it slows down it is only while it rectifies itself. Can I do this?
Well as you can tell I am quite new to GS so any help would not only be gratefully received but would bestow masses of positive karma (possibly).
I have uploaded an example - forgive the rubbish graphics as it is a proof of concept:
http://gamesalad.com/game/play/58526
..........
OK, my game is at the "proof of concept" stage, but I am pleased with my idea - now if only I could implement it ;-)
I have a ball that constantly bounces vertically. The idea is you guide it through a maze, timing the bounces to survive.
The problem is if my ball hits the walls on the corners it slows down or even stops bouncing altogether.
As you scroll the background, the camera is moved through the scene. To keep the ball in the picture I constrain its X position...
self.Position.X = scene.Camera.Origin.X +100
I think it's this that is making the ball go inside the walls which stops it bouncing; I think.
There are a couple of solutions I can think of..
1) Only adjust the X position if the ball is not colliding - is there a way to do this?
2) Force the ball to keep its speed in some way, so if it slows down it is only while it rectifies itself. Can I do this?
Well as you can tell I am quite new to GS so any help would not only be gratefully received but would bestow masses of positive karma (possibly).
I have uploaded an example - forgive the rubbish graphics as it is a proof of concept:
http://gamesalad.com/game/play/58526
Comments
I doubt that will change it but it's worth a shot. I'm useless at figuring something out if I can't see the physics.
Any help appreciated very much!
Think you need a way to keep the ball moving at a constant speed....although not sure how.
Darren.
Anyone have any thoughts on how I can keep this darn ball moving?
I think you can use the Accelerate behaviour and add Motion/Max Speed and click Apply Max Speed.
Accelerate will/can cause it to fly off but then the speed is limited by the max speed being applied.
@scitunes - I searched before posting and after your comment, you wouldn't happen to know the topic you saw or the keywords?
@Valan -I've tried to interpret your suggestion but I am very new to this. This is what my ball instance looks like now...
Collide
Bounce when colliding with: Actor with tag: bouncy
Constrain Attribute: self.Position.X To: scene.Camera.Origin.X +100
Rule
When self.Motion.Max Speed < 200
Accelerate Direction: 270 Acceleration: 100 Relative to: Actor
(the last rule is me trying to implement your suggestion). Was this when you meant? It makes no difference, also it seems acceleration has direction when my ball can get stuck on the bottom as well as the top walls.
Just have the ball accelerating down all the time.
Apply a Collision to all the Bouncy actors to collide to the ball.
Double Click onto the Ball actor.
Look in the Attributes window on the left.
Go down and access the Motion Attributes.
In Max Speed enter 200
Click on Apply Max Speed.
However, I've tried all these suggestions and scanned the forums and I can still get the ball stuck in the wall so it slows down or stops bouncing.
I was originally impressed with GameSalad, but every game I have tried to build there seems to be some problem that makes it impossible. In this game I can't even get a ball to bounce around a scene without slowing down on the corners of walls!
I am beginning to wish I hadn't wasted my money on GameSalad. I am a software developer by trade and if I can't get these basic things working, what chance is there of completing a game (even after I find one GameSalad can handle).
You can try putting it into the otherwise section of the Rule, like this:
Rule
When all conditions are valid:
Overlaps of collides with Actor of type Wall
-----
otherwise
-----Constrain self.Position.X = scene.Camera.Origin.X +100
As for the slow down when the ball collides with a wall, you can check out the magnitude demo on my profile. It shows how to keeps a couple of balls bouncing around the screen at a constant velocity. There's some math involved, but without it, the balls would slow down.
Feel free to dig into that project. Something in there might help you.
Leaving it till later often works well since it buys more time to find or get a working method.
Hiding it often leads to other creative gameplay that I wouldn't have normally thought of.
This explains the problems I am having in a nutshell! How did you learn this? Am I missing some docs?
As you suggested I have put the constrain in an otherwise condition so the ball is EITHER colliding OR having its X position constrained - that has really helped.
I still get the slow down, as you predicted, so I will look through your project example for tips to solve that.
Many thanks to you and @Valan for taking the time to help and provide hints.
Again, many thanks for all your help and suggestions. Perhaps I'll get this game done after all!