Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+1)

Here's a mod of the starfield example, allowing for speed control using the mouse.

; this is executed in the main loop:

If veteran=0

 veteran=1

 grapw=GraphicsWidth()

 graph=GraphicsHeight()

 grapw2=grapw/2

 graph2=graph/2

 For i=0 To nnn

  star_x#(i)=Rnd(0,grapw)

  star_y#(i)=Rnd(0,graph)

  star_speed#(i)=Rnd(1.001,1.01)

  star_col(i)=0

 Next

 calc_stars(nnn,1)

EndIf

Cls()

ms#=1.001+(MouseY()/graph)

calc_stars(nnn,ms)

draw_stars(nnn)


;----------------

;this is For Globals, Arrays, Media-Preloading And Functions

Global veteran=0

Global grapw=0

Global graph=0

Global grapw2=0

Global graph2=0

Global nnn=500

Dim star_x#(nnn)

Dim star_y#(nnn)

Dim star_x2#(nnn)

Dim star_y2#(nnn)

Dim star_speed#(nnn)

Dim star_col(nnn)

Function calc_stars(n,ms#)

 For i=0 To n

  star_x2#(i)=star_x#(i)

  star_y2#(i)=star_y#(i)

  star_x#(i)=star_x#(i)-grapw2

  star_y#(i)=star_y#(i)-graph2

  star_x#(i)=star_x#(i)*star_speed#(i)*ms

  star_y#(i)=star_y#(i)*star_speed#(i)*ms

  star_x#(i)=star_x#(i)+grapw2

  star_y#(i)=star_y#(i)+graph2

  star_col(i)=star_col(i)+20

  If star_col(i)>255

   star_col(i)=255

  EndIf

  If (star_x#(i)<-50) Or (star_x#(i)>(grapw+70)) Or (star_y#(i)<-50) Or (star_y#(i)>(graph+50))

   star_col(i)=0

   star_x#(i)=Rnd(0,grapw)

   star_y#(i)=Rnd(0,graph)

   star_x2#(i)=star_x#(i)

   star_y2#(i)=star_y#(i)

  EndIf

 Next

End Function

Function draw_stars(n)

 For i=0 To n

  x#=star_x#(i)

  y#=star_y#(i)

  x2#=star_x2#(i)

  y2#=star_y2#(i)

  Color(star_col(i),star_col(i),star_col(i))

  Line(x,y,x2,y2) ; here's also a bugfix btw

 Next

End Function

Nice. 👍 Any progress integrating this with Copperlicht?

On another note, I'm going to try if I can strip out all display related stuff with a server code I'm working on, otherwise I'll just do it with full JS.

Currently busy with other things. Cheers, cya.