GameMaker: Studio

GameMaker: Studio

Find, play, and make games easily
Discover, rate, and download the best player-created games made in GameMaker: Studio for free. Or try making your own and share with the community. Click here to learn more.
Logan Nov 21, 2012 @ 3:23pm
Help please
I am trying to make one of those "brick breaker" syle games where you move a paddle around at the bottom of the screen and the ball bounces around destroying bricks. However, I can't figure out how to prevent the paddle from being able to leave the playing area. Please offer any suggestions.
< >
Showing 1-9 of 9 comments 1 Nov 21, 2012 @ 3:41pm 
You could set the paddle object to wrap around the playing area, either manually by changing it's x and y coordinates, or by using this Method in GML.


This goes in the step event. ;D
Logan Nov 21, 2012 @ 5:43pm 
Thank you so much, that worked perfectly. I also have a problem with moving the ball. I set a "release space" event to move the ball in a random direction at a defined speed, but I would like to limit the user to only be able to use that once and not cheat during gameplay and avoid the bottom.
You can create a variable that will do this.
If this release space event is on the ball itself, try this...

Create event: released = false
Top of release space event: if (released == true) break
Bottom of release space event: released = true

This will create a bool, "released", that is set to false when the ball appears, and then set to true when the ball is in fact released. It won't be released if it is already true.
Logan Nov 22, 2012 @ 8:43am 
I keep trying to use that but i keep getting an error "break used without context"
Try "exit" instead of "break"! If you are using Drag and Drop instead of code, that might be the issue. PS: exit will not exit your game

Please let me know if you are using DnD or if it still doesn't work in code
M.S.T.O.P. 4 Nov 22, 2012 @ 11:10am 
The Coding Tutorial included with the program teaches you how to make a brick breaker game. You can have a look at that.
Logan Nov 22, 2012 @ 11:13am 
Ha, I never used the tutorial, thanks.
mikeygthegod Nov 23, 2012 @ 1:14pm 
Or iif using drag and drop just drag in 'Move to colision' and leave it there job done.
travis_gm 2 Dec 2, 2012 @ 3:49pm 
Put this in the step event of the paddle object.

if (x>0)
if (x<room_width)
< >
Showing 1-9 of 9 comments
Per page: 15 30 50