Graphics for a breakout game

User contributed sources that have become inactive, deprecated, or generally unusable. But ... we don't really want to throw them away either.
Tusike
Posts: 207
Joined: Jan 03, 2008 16:53
Location: Hungary

Graphics for a breakout game

Post by Tusike »

I've been working on a breakout game and have everything finished in it (like the level-editor, options, highscores, etc...) except the game part itself. The reason I didn't do that yet is that each time I started it, I felt the need to change some of the graphics, like the whole screen resolution, or the way my bmp files that contain the images are organized. So I decided to finalize my image files and hope to receive a few suggestions or good ideas from the forum.

Here is a picture of the blocks the game will be using:

http://www.savefile.com/files/1625403

The left column contains the images of the blocks that need to be hit once, the ones in the middle column need two hits.
The right column:
-First four blocks: Extra points
-Second four blocks: Just decoration, the ball simply passes through them
-Third "4" blocks: These are bonus blocks that do things. The rainbow colored gives out a random bonus, the one below it is supposed to be a dynamite and blows up all 8 other blocks around it.
-The last four are different looking walls which all do the same - simply bounce back the ball.

As you will see, the graphics of the last column aren't very good, and I still need to make up 2 bonus blocks that do something exciting (including a better-looking image for the dynamite) and still need an image for 2 more walls.

If you have any ideas about the images needed, please tell me.
Also, please say if you have any good ideas to make the game more exciting, like an occasional flash of light over a block.
Here are ideas for the bonuses that blocks may drop I have so far:

-larger/smaller paddle
-faster/slower ball
-freeze the paddle so it can't move
-ball sticks to paddle until mouse is pressed
-2/half times the points as normal
-extra life / death
-25 bullets
-a bonus that makes all the blocks go black, vica versa
-ball-split (one ball -> 2 balls, 2 balls -> 4 balls etc)
-safety bonus - the ball can't go under the paddle (a small thing catches it)
-fire ball - blows up 3*3 place instead of single blocks
-super ball - goes through all blocks

I got most of these ideas from other breakout games I've played so far, but I only "stole" these fundamental bonuses. For example, one of them had you bouncing coins to get more points, and I won't put that in, even though I'd like something like that since it makes the game more exciting.
So if you have any ideas please tell me.

-Tusike[/img]
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

Here's the picture you linked to:
Image

Some new features in the Breakout game I never finished include weather and gravity. For the gravity, the ball would be attracted to or from a certain point on the screen; there could be multiple points of gravity on the screen.

BTW, an alternative to your fire ball is a fire ball that does not bounce off the blocks when it destroys them, so it can destroy several blocks before coming back to the paddle (but I got that idea from another Breakout). ;-)
Tusike
Posts: 207
Joined: Jan 03, 2008 16:53
Location: Hungary

Post by Tusike »

For the superball I meant that it also destroys blocks and doesn't bounce back, so that would be the alternative fire ball.
I'm not so sure if gravity is a good idea, I mean what if the ball starts to circle around a given point? The ball would also slow down a lot.
And what do you mean by weather? Should it start to rain and make the ball slippery?

-Tusike
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

Weather could include many things; one of them is wind. ;-)
Tusike
Posts: 207
Joined: Jan 03, 2008 16:53
Location: Hungary

Post by Tusike »

I was thinking of rain pouring down so that it is hard to see the ball, wouldn't that be fun? Only problem with that is that even though I have a really good way to create and move "dust" particles - pieces left of blocks that were hit by the wall, but can be used as raindrops - I'm not sure if moving about 1000 raindrops will keep the program running smoothly.
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

I guess you'll have to try it; I think it will work, but maybe you would have to use less particles. ;-)
maddogg6
Posts: 824
Joined: Dec 07, 2005 22:58
Contact:

Post by maddogg6 »

Not that I would know how... but, what if you (some how?) checked machine speed, and scaled the size and amount of particles used for the rain effect?
Faster machine = more & smaller particles
Slower machine = less but bigger particles.

just an idea I had just now... sorry if it is a lame idea. :(
Tusike
Posts: 207
Joined: Jan 03, 2008 16:53
Location: Hungary

Post by Tusike »

Actually what the program will do is loop through the main loop, and do certain things when f MOD x = 0, where f is the number of frames so far and x is a number. Most machines loop through a lot of time in a second, so a figured that the faster the machine, the bigger the value of x should be.
So a fast computer would move the ball every 100 frames, a slower one maybe only 20 frames.
As for bigger drops:
What I was thinking is not having individual rain drops, but maybe a box of 10 or more drops that just appear individual.

Also, does anybody know how I can get the red, green, and blue values of a pixel from the screen in truecolor mode?

-Tusike
Lachie Dazdarian
Posts: 2338
Joined: May 31, 2005 9:59
Location: Croatia
Contact:

Post by Lachie Dazdarian »

You are talking about time-based movement. here If still contemplating how to execute it, you might wanna check this thread: http://games.freebasic.net/forum/index.php?topic=63.0

I don't think you need 1000 particles for rain alone, or even block explosions. Anyway, what might "slow down" the game is not as much the amount of particles but their (sprite) size, resolution and color bit depth.
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

Tusike wrote:Does anybody know how I can get the red, green, and blue values of a pixel from the screen in truecolor mode?
Here's some code from FInstallGUI, for 32bpp mode:

Code: Select all

#Macro itech_image_ipset (target, x, y, c)
  target[(y) * screenx + x] = c
#EndMacro

#Macro itech_image_ipoint (source, x, y, c)
  c = source[(y) * screenx + x]
#EndMacro

Sub show_loading ()
  Dim As Integer c
  Dim As Uinteger Ptr s = Screenptr
  For x As Integer = 0 To screenx - 1
    For y As Integer = 0 To screeny - 1
      itech_image_ipoint(s, x, y, c)
      itech_image_ipset(s, x, y, (Not c))
    Next y
  Next x
End Sub
Once you have the color in variable c, you can get RGB like:

Code: Select all

blue = (c shr 0) and &HFF
green = (c shr 8) and &HFF
red = (c shr 16) and &HFF
...but it's been awhile since I did that. ;-)
Tusike
Posts: 207
Joined: Jan 03, 2008 16:53
Location: Hungary

Post by Tusike »

Thanks it worked great. I'm hoping to post version 1.00 of the program (no bonuses will be added yet) this weekend.


-Tusike
Tusike
Posts: 207
Joined: Jan 03, 2008 16:53
Location: Hungary

Post by Tusike »

This piece of code here is in the beginning of the program. I don't know much about computers, so I was wondering, would the value of "t" always be larger than TIMER at the end of the FOR..NEXT LOOP?
I'm using SCREENRES 1024, 768, 24,60,(1)

The code:

Code: Select all

FOR i AS INTEGER = 87 TO 342
    t = TIMER + .005
    SCREENLOCK
    LINE (383, 0) - (641, 767), 0, BF
    bordin(408, i + 1,616,i + 33, i - 87, 0)    
    center "\3\Loading music", 0, 408, 0, i + 1, i - 87, 1    
    SCREENUNLOCK
    DO:LOOP UNTIL TIMER >= t
NEXT i
-bordin:
A subroutine that draws a border around the rectangle created by the given coordinates:

Code: Select all

SUB bordin(x1 AS INTEGER, y1 AS INTEGER, x2 AS INTEGER, y2 AS INTEGER, blender AS INTEGER, c AS INTEGER)
    c = 19 * c + 198
    PUT (x1 - 18, y1 - 18), imgset, (c, 0)-(c + 18, 18), ALPHA, blender
    PUT (x2, y1 - 18), imgset, (c, 19)-(c + 18, 37), ALPHA, blender
    PUT (x2, y2), imgset, (c, 38)-(c + 18, 56), ALPHA, blender
    PUT (x1 - 18, y2), imgset, (c, 57)-(c + 18, 75), ALPHA, blender    
    
    FOR x = x1 + 1 TO x2 - 1
        PUT(x, y1 - 18), imgset, (c + 18, 0) - (c + 18, 6), ALPHA, blender
        PUT(x, y2 + 12), imgset, (c, 50)-(c, 56), ALPHA, blender
    NEXT
    FOR y = y1 + 1 TO y2 - 1
        PUT(x1 - 18, y), imgset, (c, 18) - (c + 5, 18), ALPHA, blender
        PUT(x2 + 13, y), imgset, (c + 13, 37)-(c + 18, 37), ALPHA, blender
        
    NEXT
END SUB
center:
first I made it for centering text, but I changed it so I can print the text anywhere I want to.

Code: Select all

SUB center(text AS STRING, xmode AS INTEGER, x AS INTEGER, ymode AS INTEGER, y AS INTEGER, bl AS INTEGER, mode AS INTEGER)
    DIM AS INTEGER i, fx, fy, a, textlen, c, ii
    DIM AS STRING b    
    textlen = LEN(text)
    FOR i = 1 TO LEN(text)
        IF MID(text, i, 1) = "\" AND MID(text, i + 2, 1) = "\" THEN textlen = textlen - 3: i = i + 2
    NEXT
    IF ymode = 1 THEN y = (y-1) * 32
    IF xmode = 1 THEN x = 512 - 16 * textlen / 2
    c = 1
    f = 0
    ii = 0
    FOR i = 1 TO LEN(text)
        a = ASC(MID$(text, i, 1)) - 33
        IF MID(text, i, 1) = "\" AND MID(text, i + 2, 1) = "\" THEN c = VAL(MID(text, i + 1, 1)): f = INT((c-1)/4): c = (c-1) MOD 4 + 1:i = i + 2: GOTO con
        ii = ii + 1
        fx = (a MOD 19) + 1
        fy = INT(a / 19) + 1
        
        IF a >= 0 THEN 
            PUT ((ii-1) * 16 + x, y), fontbox, ((fx - 1) * 16 + 304 * f + 608 * mode, ((fy - 1) * 4 + fy * 28 - 28) + (c - 1) * 160)-(fx * 16 - 2 + 304 * f + 608 * mode, ((fy - 1) * 4 + fy * 28 + 1) + (c - 1) * 160), ALPHA, bl
        END IF
        IF a < 0 THEN LINE ((ii-1) * 16 + x, y) - (ii * 16 + x - 1, y + 32), 0, BF
        
        con:
    NEXT
END SUB
KristopherWindsor
Posts: 2428
Joined: Jul 19, 2006 19:17
Location: Sunnyvale, CA
Contact:

Post by KristopherWindsor »

I think what you are asking is if that code will loop in less than .005 seconds, and that depends on the computer's speed. ;-)

BTW, did I read that right? Are you using 60 screen pages? :-P
Tusike
Posts: 207
Joined: Jan 03, 2008 16:53
Location: Hungary

Post by Tusike »

I know that my 1GHz computer can do it, I just don't know if a 500MHz computer can do it too.

And thanks, Kristopher, for pointing that out! Actually I'm not using any screen pages (is page flipping faster that SCREENLOCK/UNLOCK?), that was supposed to be the refresh rate, but I somehow managed to delete a few commas before the number 60.
(SCREENRES 1024, 768, 24,, 1,60)

-Tusike
Mysoft
Posts: 836
Joined: Jul 28, 2005 13:56
Location: Brazil, Santa Catarina, Indaial (ouch!)
Contact:

Post by Mysoft »

Tusike wrote:is page flipping faster that SCREENLOCK/UNLOCK?
no.. screenlock/unlock is the best way... page flipping is more for compatiblity, or maybe in future fbgfx may have hardware page flipping... (probably not)
Post Reply