News:

Function Finder  Find all the functions within source code files

Main Menu

compact breakout

Started by stef, December 28, 2005, 06:46:27 AM

Previous topic - Next topic

stef

Hi!

I think this code is very short and simple (short doesn't mean fast!,but the aim was to keep the code as short as possible)
First I planned to make it as one-line-code, but this didn't work correctly.

Use mouse

Greetings
stef


; PROJECT : breakout
; AUTHOR  : stef
; CREATED : 28.12.2005
; EDITED  : 28.12.2005
; ---------------------------------------------------------------------
;use mouse
;if it is too fast 'setfps 100'

OpenScreen 800,600,16,2
Dim bl(200)
r=255
a#=400
b#=550
c#=0.02
d#=0.02
Do
Cls 0
For y=100 To 280 Step 20
For x=0 To 760 Step 40
If bl(n)=0 Then BoxC x,y,x+38,y+18,1,RGB(r,12*y-r,0)
BoxC m,560,m+80,570,1,RGB(0,0,r)
CircleC a#,b#,8,1,RGB(r,r,r)
If PointInBox(a#,b#,x,y,x+38,y+18)And bl(n)=0
bl(n)=1
d#=-d#
EndIf
If a#<0 Or a#>800 Then c#=-c#
If b#<0 Or (PointInBox(a#, b#,m,556,m+80,560)And d#<0)Or b#>600 Then d#=-d#
Inc n
a#=a#-c#
b#=b#-d#
Next
Next
Print "FPS: "+Str$(FPS())
Sync
If n=200 Then n=0
m=MouseX()
Loop

Digital Awakening

Fast enough here. The pad needs some smoothing.
Wisit my site at: DigitalAwakening.net

thaaks

That's compact code for a breakout game  :D
I will give it a try tonight.

Thanks for posting source code again, Stef! I think it is highly appreciated (at least by me!!!) and your demos and code ideas are always something special and give me a lot to learn from - thanks again!

Tommy

medwayman

That's very good for so few lines!

:)

stef

Hi!

Thanks for replies!
It is really that what I said above.The only aim was shortness.

If you use this code, you better 'expand' it.

Greetings
stef

stef

Hi!

It's not that important. But I would like to say that the code above is from me.
You can do with this code what you want. You can also change it.
But then please present it not under my name. Present it under your name!

Greetings
stef