File: basic256_icon.kbs

package info (click to toggle)
basic256 0.9.6.69a-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 26,304 kB
  • sloc: cpp: 7,778; yacc: 926; lex: 575; sh: 21; makefile: 7
file content (46 lines) | stat: -rw-r--r-- 898 bytes parent folder | download
1
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
44
45
46
print "Generate BASIC256 icon"

graphsize 512, 512

rem set up initial ball position and speed
x = 20 * graphheight / 300
y = 100 * graphheight / 300
r = 20
rw = 3
yvel = -1.0 * graphheight / 300
xvel = 1.10 * graphwidth / 300
yacc = .0098 * graphwidth / 300

fastgraphics
color darkblue
rect 0,0,graphwidth, graphheight

loop1:
rem change the downward velocity according to the acceleration
yvel = yvel + yacc

rem calculate new position
y = y + yvel
x = x + xvel

rem check for collisions
if y > graphheight - r - 1 then yvel = -0.9 * yvel : y = graphheight - r - 1 : xvel = xvel * 0.9
if x > graphwidth - r - 1 then xvel = -xvel : x = graphwidth - r - 1
if x < r then xvel = -xvel : x = r

rem draw the ball
gosub drawBall
if xvel * xvel < 0.0001 then
   refresh
   end
end if
goto loop1

drawBall:
color darkgray
circle x, y, r
color gray
circle x, y, r - rw
if rand < .01 then refresh
return