Help with my Breakout Game
Posted: Sun Oct 18, 2015 2:41 am
Hello and Good Day!
I am brand new to Love, as in, tonight I am building my first simple game, ever. It is attached. I am trying just to jump in and build something. I have a background in PHP and Javascript. I found a pong game online and I want to adapt it to be a breakout game.
I have 3 little questions and 1 big one.
1. How can I get the console to print out a variable and a string. Like in Javascript I want:
> console.log( 'game.timerLimitCycles = ' + game.timerLimitCycles );
When I do the equivalent in Love I get errors, so I am stuck with just
print (game.timerLimitCycles)
2. Right now my game is just a paddle and ball, with the ball progressively speeding up as it bounces around the screen. But sometimes it seems to jump/hiccup a little. Is this just my machine? Or possibly in my head? If it is a real issue, is there something I can do about it?
3. I know there are three main functions (load, draw and update). Is it normal to stick my own functions "in between" these ones? It feels funny to me doing so? Maybe my "startGame()" and "spawnBall()" should be part of "love.load()"? Or somewhere else?
4. Finally, here is my big question: How should I do the bricks? I am just going to plow ahead after I write this, but I would love some advice from more experienced people. I figure I can just have a loop that writes out 30 or so rectangles, and keep a note of their position (upper left x and y), and then just do some pseudo "collision detection" (like I did the paddle and ball) for all 30 of them, and as they get hit, one by one decrease brick.totalNum by one until I get to 0. But this is going to call upon some loops and classes that I am unfamilair with as of yet? Also, it seems a bit inefficient to test the locations of 30 objects over and over? But maybe that is the only way?
Thanks for any insights anyone can give me!
I am brand new to Love, as in, tonight I am building my first simple game, ever. It is attached. I am trying just to jump in and build something. I have a background in PHP and Javascript. I found a pong game online and I want to adapt it to be a breakout game.
I have 3 little questions and 1 big one.
1. How can I get the console to print out a variable and a string. Like in Javascript I want:
> console.log( 'game.timerLimitCycles = ' + game.timerLimitCycles );
When I do the equivalent in Love I get errors, so I am stuck with just
print (game.timerLimitCycles)
2. Right now my game is just a paddle and ball, with the ball progressively speeding up as it bounces around the screen. But sometimes it seems to jump/hiccup a little. Is this just my machine? Or possibly in my head? If it is a real issue, is there something I can do about it?
3. I know there are three main functions (load, draw and update). Is it normal to stick my own functions "in between" these ones? It feels funny to me doing so? Maybe my "startGame()" and "spawnBall()" should be part of "love.load()"? Or somewhere else?
4. Finally, here is my big question: How should I do the bricks? I am just going to plow ahead after I write this, but I would love some advice from more experienced people. I figure I can just have a loop that writes out 30 or so rectangles, and keep a note of their position (upper left x and y), and then just do some pseudo "collision detection" (like I did the paddle and ball) for all 30 of them, and as they get hit, one by one decrease brick.totalNum by one until I get to 0. But this is going to call upon some loops and classes that I am unfamilair with as of yet? Also, it seems a bit inefficient to test the locations of 30 objects over and over? But maybe that is the only way?
Thanks for any insights anyone can give me!