Author Topic: Brick Smasher  (Read 6116 times)

0 Members and 1 Guest are viewing this topic.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Brick Smasher
« on: July 06, 2019, 12:52:05 am »
Hi all,

Today I spent all day long making a Breakout style game. I've never made one and have always wanted to. I see some of you have made them, I still need to check those out. I tried twice to add the mouse to it but with my code it's not really adaptable, which is fine. I also tried it with non-stop movement, besides pressing up or down to stop it. But that was a bit tedious so I kept with the old fashion way of just left or right arrow keys. It works best when you keep pressing it and not holding it down. It takes a little getting used to. The colors of the bricks are a random color per level. It doesn't give you any control of your diagonal shot, but instead 100% random. That I think makes it a bit harder (and easier to code for me lol). Also, sorry about having so much code, I know the best programmers use as little code as possible, but this is the only way I know pretty much,  and the way I used to program decades ago.
So here it is..... Brick Smasher. Enjoy!

(Code deleted, much better mouse version I made is below.)
« Last Edit: July 06, 2019, 03:14:21 pm by SierraKen »

Offline Petr

  • Forum Resident
  • Posts: 1720
  • The best code is the DNA of the hops.
    • View Profile
Re: Brick Smasher
« Reply #1 on: July 06, 2019, 06:01:18 am »
Nice program. I also never tried to write anything like that. Maybe I'll try it sometimes.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Brick Smasher
« Reply #2 on: July 06, 2019, 11:33:15 am »
Wow! Takes me back in time to when I used to play Breakout on my Atari 2600. I do miss the paddle controllers for games like this. You know, with QB64 and a mouse wheel, you could simulate that same paddle effect? I mentioned that in a post some time ago, and got a reply that would be like adding a Microsoft "accessibility" feature. What? When people talk like that, it makes me want to break both their legs, put them in a wheel chair, and air drop them over some cannibalistic tribe in Africa. I'd pay for it all by creating a 501-C3 tax exempt organization, and I'd call it something like "Meal on Wheels." Oops, sorry, dredging up some old bad memories.

And now, back to our regularly scheduled programming...

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Brick Smasher
« Reply #3 on: July 06, 2019, 12:29:46 pm »
Wow! Takes me back in time to when I used to play Breakout on my Atari 2600. I do miss the paddle controllers for games like this. You know, with QB64 and a mouse wheel, you could simulate that same paddle effect? I mentioned that in a post some time ago, and got a reply that would be like adding a Microsoft "accessibility" feature. What? When people talk like that, it makes me want to break both their legs, put them in a wheel chair, and air drop them over some cannibalistic tribe in Africa. I'd pay for it all by creating a 501-C3 tax exempt organization, and I'd call it something like "Meal on Wheels." Oops, sorry, dredging up some old bad memories.

And now, back to our regularly scheduled programming...

Pete

Yeah Fellippe and I both use mouse controlled paddles for Breakout:
https://www.qb64.org/forum/index.php?topic=1183.msg103809#msg103809

But using a Mouse wheel sounds brilliant! that would solve my problem with Ping Pong with mouse drifting off screen and jamming the paddle. I must try that!

This version though very basic has all necessary elements but the arrow keys seem a tad unresponsive or delayed response. Maybe a _display and a _limit in the main loop would regulate interval updates.

Update: It has _LIMIT... so now I wonder:

Does _LIMIT even work in loops that use GOTO instead of a formal loop structure like WHILE... WEND or DO... LOOP?
« Last Edit: July 06, 2019, 12:35:05 pm by bplus »

FellippeHeitor

  • Guest
Re: Brick Smasher
« Reply #4 on: July 06, 2019, 12:50:27 pm »
About limit: it does.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Brick Smasher
« Reply #5 on: July 06, 2019, 03:13:45 pm »
You guys rock! I just changed the input from arrow keys to the mouse wheel and it works tons better! Thanks! I also saw an error on the last code and cleaned it up some. I had forgotten to wipe clear the old brick memory before going into the next level. If you find anymore errors, please tell me, thanks. Because of the mouse having to stay on the screen to use the mouse wheel, I changed the game to _FULLSCREEN and put the title, score, paddles, and level up on top. Doing that I lowered the top edge of where the ball hits so it wouldn't leave a mess on top. That took a few tries. It's amazing how much leeway you have to give to graphics in motion for that kind of stuff. There is a tiny bit of scattered graphics, like the deleted ball will sometimes show up on the next level's brick as part of a hole, but I'm just going to leave that. Also you probably noticed already that sometimes the ball will hit a corner of a brick and just erase that corner and not get rid of the brick. I'm just going to call that "not good enough of a hit"LOL. So here it is, all shiny and new. :) Thanks again. I'll add this to my website real soon.
P.S. Notice how I changed the mouse wheel coordinates by using oldwheel, for your own programs. 

(Code deleted again to add some control to the ball. Code is on the next page of this thread.)
« Last Edit: July 08, 2019, 12:48:24 pm by SierraKen »

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Brick Smasher
« Reply #6 on: July 06, 2019, 03:20:14 pm »
Oh yeah, much better with Wheel!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Brick Smasher
« Reply #7 on: July 06, 2019, 03:38:38 pm »
Full Screen and wheel work well together. I barely got to level 5, but since I hardly ever play games, I guess that's not too bad.

I'm really glad you have the skill to make these types of changes without needing someone else to code those changes for you. It's usually the other way around, which is fine, but I find this t be a refreshing change.

Now if you really want to impress me, go make StarMaster. Kidding aside, that was my favorite game, made by Activision, for the Atari 2600. I got so good at it, I made the counter recycle itself once!

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Brick Smasher
« Reply #8 on: July 06, 2019, 04:19:50 pm »
Wow Pete! I didn't know about that game Starmaster until I just looked on YouTube. I've been thinking about making a game similar to this. You fly around and shoot in 3D like that. It will take a few steps to make it eventually. First the 3D stars part, but I have made star fields before. Then the turning and stars turning with you. Then the enemy ships and if I want to add a map. I'll think about it. :) But like I said, it would be a bit different. Also if I want to add land, I will have to figure out the geometry needed. But we'll see. :)

Offline OldMoses

  • Seasoned Forum Regular
  • Posts: 469
    • View Profile
Re: Brick Smasher
« Reply #9 on: July 06, 2019, 06:12:50 pm »
That was cool. I couldn't hack it with my old reflexes, but it was cool.

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Brick Smasher
« Reply #10 on: July 06, 2019, 07:51:16 pm »
Thanks OldMoses. :) I'm going to put it on my website now. It will be at the bottom of the page below my other programs and games. http://ken.x10host.com/qb64/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Brick Smasher
« Reply #11 on: July 07, 2019, 09:57:19 am »
That was cool. I couldn't hack it with my old reflexes, but it was cool.

It's completely random bounces that puts me off. I know you need to add some randomness to bounce otherwise the ball could get stuck in a rut but complete randomness makes it a game of luck, not skill.

What is cool is simplicity of bricks setup and nice ball bouncing action between them, fun! I want more bricks, deeper levels, wider screen and less randomness in bounces.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Brick Smasher
« Reply #12 on: July 07, 2019, 02:09:28 pm »
I want more bricks, deeper levels, wider screen and less randomness in bounces.

Let's throw the moon in, while we're at it.... (_|_)

Pete :D
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Brick Smasher
« Reply #13 on: July 07, 2019, 11:33:58 pm »
LOL!

Hi Pete,

Your little drawing reminds me of another idea I had for this game. If you do add more bricks wider and deeper, you could also draw vertical lines to make compartments to prevent a ball from cleaning out the entire back rows in a good and lucky bounce pattern.

Yeah so I'll take the moon with a side order of stars!

Offline SierraKen

  • Forum Resident
  • Posts: 1454
    • View Profile
Re: Brick Smasher
« Reply #14 on: July 08, 2019, 12:43:37 am »
Yes, I know it's all random. But it does have skill, to try to be able to hit the ball without missing it. That's the whole game. :) Right now I don't think I want to mess with this game anymore, I think I need a little break from programming before I get burnt out. I kinda went wild on it for about a month lol. Today I bought a website domain for my website if anyone wants to check it out. I also spruced up the look a tiny bit. http://www.kensprograms.com/