Juggler
Here’s some FAQ to help you along with the Juggler project, I’ll
TODO: post how they can ask more questions
Where do I start?
Starting with a blank project can be kind of intimidating. Here’s one way you can break the project into smaller tasks
- Create
sWall
,sBall
andsPaddle
sprites - Create corresponding
oWall
,oBall
, andoPaddle
objects - Make
oPaddle
move left/right - Make
oBall
fall - Add a collision between
oPaddle
andoBall
to handle bounce (mine has aiming, but you can start with a basic collision) - Add a collision between
oBall
andoWall
as well - Use the outside room event to make
oBall
reset - Draw the points (I handled it from the
oPaddle
, but you can do any object) - Increase points whenever
oBall
collides w/oPaddle
- Reset points when
oBall
goes outside the room - Add a custom font for the points
How do I implement gravity?
Use the built in gravity variable
This defines how quickly the vspeed increases (acellerates), and you setting the variable in our create event should be enough
// oBall Create Event
gravity = .5;
The ball bounces get shorter everytime, how do I make it consistent?
Yeah, I hit this issue too and it caught me off guard
I’m actually not sure why this happens? My best guess is a precision error
Anyway, it happened to me because I was only setting the direction
in the oBall
and oPaddle
collision event. If I set speed
and direction
that keeps the bounces more consistent
My ball keeps going through walls, how do I fix it?
There’s a couple of reasons why this could happen
- For starters, make sure your collision event is correct. There should be a
oWall
collision event, in theoBall
object - Assuming you implement the collision event as
hspeed = -hspeed
, it’s possible the collision event is triggering multiple times and the ball is getting stuck. MakingoWall
solid can help with this - If solid isn’t enough to fix it, then we need to add logic to guarantee that the hspeed comes out in the right direction. You can use an if statement together with
abs()
to acheive this. So if the ball is all the left side of the room, we wanthspeed
to become positive, and if it’s all the right side we wanthspeed
to be negative