Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Simple Brick Breaker
Index -> Programming, Turing -> Turing Submissions
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Aange10




PostPosted: Sun Dec 04, 2011 2:57 pm   Post subject: Simple Brick Breaker

I got bored and decided to make a Brick Breaker. Here's what I came up with in about two/three hours.


The code is commented, as it is a habit.

Enjoy.



Game.t
 Description:

Download
 Filename:  Game.t
 Filesize:  8.92 KB
 Downloaded:  1420 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
mirhagk




PostPosted: Sun Dec 04, 2011 4:36 pm   Post subject: RE:Simple Brick Breaker

The collision off of the blocks is glitchy (sometimes bounces in the wrong direction) but other than that, it is pretty good. This is one of the things I like about Turing, it only takes a tiny amount of time to get something like this working.
Aange10




PostPosted: Sun Dec 04, 2011 9:36 pm   Post subject: RE:Simple Brick Breaker

Off the blocks? I don't see why, it simply inverses the x velocity.

If you mean when it bounces off the paddle, that is intended - its suppose to be a way of aiming; if you move to the right, right before the ball hits you it will go in that direction no matter what. And same for if you go to the left when it hits your paddle.
Aange10




PostPosted: Mon Dec 05, 2011 12:37 am   Post subject: Re: Simple Brick Breaker

After about another hour and a half:



Note: Bottom of code is what I'll be adding.



BrickBreaker.rar
 Description:

Download
 Filename:  BrickBreaker.rar
 Filesize:  144.12 KB
 Downloaded:  626 Time(s)

Velocity




PostPosted: Mon Dec 05, 2011 9:38 am   Post subject: RE:Simple Brick Breaker

Good job man + bits
2goto1




PostPosted: Mon Dec 05, 2011 10:29 am   Post subject: RE:Simple Brick Breaker

Looks good. What would be nice would be to proportionally invert the x velocity depending on the location that the ball hits the paddle. That would make the movement feel less grid-like. And perhaps gradually increasing ball velocity in a given level if there has not been any brick contact for a given period of time.
Aange10




PostPosted: Mon Dec 05, 2011 5:27 pm   Post subject: Re: RE:Simple Brick Breaker

2goto1 @ 5/12/2011, 9:29 am wrote:
Looks good. What would be nice would be to proportionally invert the x velocity depending on the location that the ball hits the paddle. That would make the movement feel less grid-like.



And what would these porportions be? As in, what change is there in reflection if the ball hits at the right or the left front of the paddle?

Quote:

And perhaps gradually increasing ball velocity in a given level if there has not been any brick contact for a given period of time.


I'm going to implement that, along with some better upgrades, music. I'm going to post how long I work on each version. I'm going to try and make it *fun* to get to level 10, and win (I currently am bored after level 2). I'm going to up the graphics a bit, and even add some graphic 'upgrades' to 'buy'.


Thanks for the feedback.
Tony




PostPosted: Mon Dec 05, 2011 5:46 pm   Post subject: Re: RE:Simple Brick Breaker

Aange10 @ Mon Dec 05, 2011 5:27 pm wrote:
And what would these porportions be? As in, what change is there in reflection if the ball hits at the right or the left front of the paddle?

Linear, log, etc. Pick a function that approximates the "real" shape (as in one responsible for calculating the angles of bounces, not the image on screen) of the paddle, and play with the constants to have it match up. A neat powerup would be one that swaps that function (e.g. convex -> concave shape)
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Sponsor
Sponsor
Sponsor
sponsor
Aange10




PostPosted: Mon Dec 05, 2011 6:23 pm   Post subject: RE:Simple Brick Breaker

Not quite sure how to do that >.<. The most hands on I've ever been with physics is taking the shadow of a ruler, and comparing that shadow to the shadow of a tree to find out how tall the tree is. And really that's just basic algebra. (r/rshadow = t/tshadow).

Not really sure 1) How to find the angle it would bounce off at, 2) How to determine the energy the paddle would absorb. Im in AP for all my classes, including math, but like I said: I've never used physics hands on. Nor have I taken a physics class.

Currently Alg 2
Tony




PostPosted: Mon Dec 05, 2011 6:39 pm   Post subject: RE:Simple Brick Breaker

spherical cows in a vacuum http://en.wikipedia.org/wiki/Spherical_cow

simplify things until it makes sense. Doesn't have to be real-world accurate.

1) on a flat paddle, angle-in == angle-out. To make it more interesting, you'd want to bend that angle-out one way or another, by some factor. Draw some sketches on paper.

2) Doesn't have to absorb any energy. Paddle is made out of rhenium diboride and is of infinite weight Wink
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Aange10




PostPosted: Mon Dec 05, 2011 11:13 pm   Post subject: Re: Simple Brick Breaker

Here's about two more hours of work. I have another project I'm working on, so not a ton of time for this, however, I'm fairly sure that I'll be able to complete this soon.

The change of speed after x time has been implemented, and I made sure it doesn't carry on through the levels.

The proportions have been added as well (Lines 251 - 280), however, I'm not sure how fun or realistic they are, haha. But this is my take on what I was told.

enjoy my compsci blogging...



EDIT: Also, I did not change the x velocity values, I changed the y velocity values. Given that the reason I'm doing this is to change the slope (y/x) [Aka the 'angle' its going at], it should be the same. I merely did the Y values because it would be less if-statements (: (Yv will always be negative, whereas I have to check that with Xv)



BrickBreaker.rar
 Description:

Download
 Filename:  BrickBreaker.rar
 Filesize:  148.43 KB
 Downloaded:  475 Time(s)

2goto1




PostPosted: Tue Dec 06, 2011 10:16 am   Post subject: RE:Simple Brick Breaker

Nice update, that improves the movement! There are no hard and fast rules for your movement algorithms, they don't have to even mimic the real world. You can always play around with different algorithms, and perhaps randomly select an algorithm to use when each level starts, etc.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Submissions
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: