fb:porticula NoPaste
Es lebt!
Uploader: | AndT |
Datum/Zeit: | 29.12.2008 00:58:52 |
' Programmiert von AndT
type xycor
x as integer
y as integer
end type
dim shared as uinteger stars = 50000 ' alle objeckte
dim shared as ubyte mapsize = 7
dim shared as ubyte speed = 5
dim shared as xycor res
dim shared as xycor rendercor
dim shared as ubyte starsize
' Screen resulotion
with res
.x = 640
.y = 480
end with
dim shared as xycor starmap (1 to stars)
for i as integer = 1 to stars
with starmap(i)
.x = -res.x*mapsize
.x + = (int(rnd*res.x)*(mapsize*2))
.y = -res.y*mapsize
.y + = (int(rnd*res.y)*(mapsize*2))
end with
next
screenres res.x,res.y
sub RenderSystem
screenlock
cls
for i as integer = 1 to stars
with rendercor
.x = res.x / 2 +starmap(i).x
.y = res.y / 2 +starmap(i).y
' Nur ein paar regeln zum Tuning der FPS :)
if .x > 0 and .y > 0 then
if .x < res.x and .y < res.y then
circle (.x,.y),2,15,,,,f
end if
end if
end with
next
screenunlock
end Sub
function InputSystem as ubyte
DIM AS STRING KEY = INKEY
select case KEY ' EINGABE BITTE :)
case ("i")
return 2
case ("k")
return 1
case ("l")
return 3
case ("j")
return 4
case chr(27)
end
case ""
sleep 1
end select
end function
' Steuert Kamera und Leben xD
Sub CorCtrl(code as ubyte)
dim as xycor cormod
with cormod
select case code
case 1
.y = -speed
case 2
.y = speed
case 3
.x = -speed
case 4
.x = speed
end select
for i as integer = 1 to stars
starmap(i).x+=.x+int(rnd*2)-int(rnd*2)
starmap(i).y+=.y+int(rnd*2)-int(rnd*2)
next
end with
end Sub
' Main Loop (yes, thats all xD)
do
RenderSystem
CorCtrl (InputSystem)
Loop