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,sBallandsPaddlesprites - Create corresponding
oWall,oBall, andoPaddleobjects - Make
oPaddlemove left/right - Make
oBallfall - Add a collision between
oPaddleandoBallto handle bounce (mine has aiming, but you can start with a basic collision) - Add a collision between
oBallandoWallas well - Use the outside room event to make
oBallreset - Draw the points (I handled it from the
oPaddle, but you can do any object) - Increase points whenever
oBallcollides w/oPaddle - Reset points when
oBallgoes 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
oWallcollision event, in theoBallobject - 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. MakingoWallsolid 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 wanthspeedto become positive, and if it’s all the right side we wanthspeedto be negative