Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  BlockBasher - My first game in Java 2D.  (Read 1492 times)
0 Members and 1 Guest are viewing this topic.
Offline danieldean
« Posted 2014-07-08 08:57:18 »



I have gone from Showcase to WIP with this as I've completely taken it apart as I couldn't fix bugs as it was. The links below aren't available at the moment but should be back and better shortly.

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------

My first game in Java 2D. No external dependencies or libraries. Made following trial and error, some reading up on here, and other places. If anyone's kind enough to look at the source to see if I've gone badly wrong it's here:

https://github.com/danieldean/BlockBasher

The commenting is a little verbose but that's to help me for now. My hit detection is also a little dodgy and I may have a go at fixing that in the future. You can download a complied and ready to go JAR here:

https://github.com/danieldean/BlockBasher/releases

I'm also learning to use Git and Semantic Versioning. This as a warm up and refresh for distance learning as I'll be doing Java after summer. I'm not that new to Java but I am new to painting and games in Java.

Thanks!
Offline death_angel
« Reply #1 - Posted 2014-07-08 09:44:27 »

I danieldean i played your game and you should fix some things:
- You should put the windows size dinamic because its too big in my laptop
- The player rectangle or something ehh (dont know the name) should collide on sides of the game window
- When the ball touches the sides of the rectangle, it enters the rectangle (sorry for my bad english)
- Put the arrow keys because it easier to play

And i think it all i found
Nice game
Keep it up Cheesy

 -death

Like a Boss Hacker
Offline danieldean
« Reply #2 - Posted 2014-07-08 10:39:22 »

I danieldean i played your game and you should fix some things:
- You should put the windows size dinamic because its too big in my laptop
- The player rectangle or something ehh (dont know the name) should collide on sides of the game window
- When the ball touches the sides of the rectangle, it enters the rectangle (sorry for my bad english)
- Put the arrow keys because it easier to play

And i think it all i found
Nice game
Keep it up Cheesy

 -death

Thanks for your feedback.

I didn't realise the window size is a problem, as I'm using FHD, I fixed it because I had difficulties with getting the blocks to fit the screen with integer arithmetic if I allowed it to be changed. I'd need to change everything to use doubles, Graphics2D and Rectangle2D.Double, etc., which could be a lot to do now. I think I can allow anything with 4:3 as the aspect ratio without problems. I'll look into this.

I guess you mean the paddle can go off the play area. I didn't think about this but easily fixed. If you release the ball whilst the paddle is out of the play area it causes even more problems. Shocked Collision detection needs fixing. I know this but I'm trying to figure out what might be better.

I can change the key bindings easily enough, maybe I can make them and the window size be set by the player somehow.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline danieldean
« Reply #3 - Posted 2014-07-09 11:50:28 »

- You should put the windows size dinamic because its too big in my laptop

The game is now able to be resized, but for now you must change the constants. I haven't made a way to do this after compilation so I've yet to make a release with JAR.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #4 - Posted 2014-07-09 21:18:16 »

Hi! Nice game. I played it for a bit, and now I have some feedback for you. Smiley

I could not see my score throughout the game, even though the picture you posted shows it in the corner. That bummed me out a bit.
It seems that the controls offer no aim, making the ball go in the same pattern throughout the entire game. I suggest finding the ball's new direction based on where it hit on the paddle. While on the subject of the ball's direction, I noticed in your code that the ball does not posses a velocity - only a position. I think you could simplify your code by introducing a velocity vector to the ball, instead of storing this information in temporary variables in the main class. This change would also make changing the balls direction much easier. Everyone wins. Cheesy

If you do the same thing to your paddle, you could make it control very differently. Right now it's very tight, and responds with immediate effect. A velocity vector could add a heavier feel to it, making the paddle more difficult to stop, or change direction. This would make the game a bit more challenging.

Your code looks really neat, although there are some things I do not quite understand. One of these things, is the need for x2 and y2 variables. They could easily be replaced by a getter, adding only an extra calculation. I think that is worth the saved complexity.

The black background is a little bit dull, and I think it would be a shame not to generate at least something. Even a gradient would make it no much prettier. Remember bubble struggle? That game only had some gradients for backgrounds and it worked perfectly, making each level memorable.

There are tons of ways to improve a game like yours, but I think you did a good job. Your code does what you meant it to do, and it does so in a clear fashion. Good job on the game.  Smiley

Offline danieldean
« Reply #5 - Posted 2014-07-10 07:58:48 »

Hi there. Thanks for trying.  Smiley

I'm a little confused why you don't see the score. Do you see the splash screens for the game start, over and levels? It's all the same font so if you do I thinks that's very strange. My painting code for this is very straightforward and I don't think it should go wrong unless I have sync issues.

Point taken on the velocity vector, I can probably add this to my Sprite and have it across the board. The only reason for having x2 and y2 is that it made the intersection code a bit simpler but in something else I've started I've gone with getters instead. They are unneeded variables because they're just x + width so I'll get rid of them.

Edit: I have given the paddle velocity, using vx, vy and made a tick() method, limiting it's speed by the magnitude. Clearly it only works in one dimension with the paddle. Can you try it? http://www.java-gaming.org/user-generated-content/members/295784/blockbasher.jar, I think it's what you mean.
Offline Mads

JGO Ninja


Medals: 26
Projects: 3
Exp: 6 years


One for all!


« Reply #6 - Posted 2014-07-12 07:13:09 »

Sure. I do see the splash with the title and directions. I still don't see the score, though.

If I make the paddle move before shooting the ball, it glitches out a little. I also seems that the paddle once again can go through the sides.
It looks like you implemented what I described, however it feels weird. It may just be a too high maximum velocity, or too much velocity given when pressing a button. Smiley

Online SwordsMiner

JGO Coder


Medals: 3
Projects: 2
Exp: 1 year


The one and only.


« Reply #7 - Posted 2014-07-15 18:07:06 »

Oh man, this brings back nostalgia. My first game was a Brick Breaker just like this. Looks cool man! Roll Eyes

If I made you laugh, helped you at all, or did something cool, I only ask that you smash that appreciate button with your nose.
Offline danieldean
« Reply #8 - Posted 2014-07-15 19:17:47 »

Thanks, that's kind of the idea and why I've kept the contrasting colours in to give it that look.

For the moment this isn't available on GitHub as I've gone completely back to the drawing board with it to give it separate tick and render along with vectors and reflection. So when it comes back you should really be a player not just going through the motions!  persecutioncomplex As it was you'd play the same game each time if you didn't move at the start and the random ball start was the same.

In the mean time this https://github.com/danieldean/Bounce is serving as a demo of my bouncing so I can get it right and finish the game. You can download a JAR under releases.
Pages: [1]
  ignore  |  Print  
 
 

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Longarmx (36 views)
2014-10-17 03:59:02

Norakomi (28 views)
2014-10-16 15:22:06

Norakomi (24 views)
2014-10-16 15:20:20

lcass (27 views)
2014-10-15 16:18:58

TehJavaDev (52 views)
2014-10-14 00:39:48

TehJavaDev (54 views)
2014-10-14 00:35:47

TehJavaDev (42 views)
2014-10-14 00:32:37

BurntPizza (63 views)
2014-10-11 23:24:42

BurntPizza (36 views)
2014-10-11 23:10:45

BurntPizza (77 views)
2014-10-11 22:30:10
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!