Pomppiva pallo
Author: KilledWhale
Added: 9. huhtikuuta 2011 kello 21.21
Edited: 15. huhtikuuta 2011 kello 22.19
Category: Efektit
Description
Pomppiva pikselipallo, jonka tein xor-demoa varten.
Code
Select all1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | // Simple bouncing ball -effect made with CoolBasic
SCREEN 320, 240, 24, cbsizable
Dim texture(320, 240)
Dim cc(150) As Float
For dd = 0 To 150
cc(dd) = CurveValue(25, dd, 3) / 25
Next dd
textture = MakeImage(320, 240)
MaskImage textture, 255, 0, 255
Lock Image(textture)
For x = 0 To 319
For y = 0 To 239
p = 0
For i = 0 To 9
p = p + ((((x Shr i) Mod 2) Xor ((y Shr i) Mod 2)) And ((31 Shr i) Mod 2)) Shl i
Next i
texture(x, y) = p Shl 3
PutPixel2 x, y, p Shl 5 + 10485760, Image(textture)
Next y
Next x
Unlock Image(textture)
start = Timer()
Repeat
tm = Timer() - start
an# = Timer() / 3000.0
x = tm / 28
y = 60 + Sin(x * 7) * 35
For yy = -25 To 25
For xx = -25 To 25
dd = Distance(0, 0, xx, yy)
If dd < 25 And xx + x > 0 Then
cs# = cc(dd)
sx = xx * cs + x
sy = yy * cs + y
Color texture((sx + 320) Mod 320, (sy + 240) Mod 240), 0, 0
Box ((x + xx) Shl 1) Mod 320, (y + yy) Shl 1, 2, 2
EndIf
Next xx
Next yy
SetWindow Str(FPS()), 3
DrawScreen
Forever
|
Comments
No comments. You can be first!
Leave a comment
You must be logged in to comment.