Oxygen Basic

Programming => Example Code => Topic started by: Peter on November 28, 2015, 06:50:03 AM

Title: Clouds
Post by: Peter on November 28, 2015, 06:50:03 AM
Hi,
Code: [Select]
include "gp.inc"
Window 800,600,1
SetCaption " LEVITATING CLOUDS"
SmoothMode 1
loadimage "bmp/bigstar.png",1

Type Star
  sys xStar
  sys yStar
  sys speed
End Type

Dim Stars(250) As Star
sys xRes =800
sys yRes =600

sys i
For i=1 To 250
   Stars(i).xStar = Rnd(1, xRes -2)
   Stars(i).yStar = Rnd(1, yRes -2)
   Stars(i).speed = Rnd(1, 4)
Next

Sub MoveStars()
sys i
For i=1 To 250
   color 55,255,250,250
   FillEllipse Stars(i).xStar,Stars(i).yStar,200,100
   Stars(i).xStar = Stars(i).xStar + Stars(i).speed
   iF Stars(i).xStar > xRes
      Stars(i).xStar = -128
      Stars(i).yStar = Rnd(1, yRes -2)
      Stars(i).speed = Rnd(1, 4)
   End iF
Next
End Sub

while Key(27)=0
  cls 55,0,0,0
  drawimage 1,300,200,0
  MoveStars
  color 255,0,255,0
  text 320,16,28,"CLOUDS "
  redraw
  wait 10 
wend




.
Title: Re: Clouds
Post by: jack on November 28, 2015, 08:42:47 PM
hello Peter
have a look at this web site, there's tons of interesting Javascript graphic demos with source http://bl.ocks.org/mbostock
Title: Re: Clouds
Post by: Peter on November 29, 2015, 02:31:21 AM
Thanks Jack,

But Java is not so easy to translate to OxygenBasic.
I am missing a lot of commands here in OxygenBasic.

I would have to improvise too much.
Title: Re: Clouds
Post by: JRS on November 29, 2015, 02:48:27 AM
Quote
But Java is not so easy to translate to OxygenBasic.

I'm sure it is but that isn't what Jack's link to the examples are written in. JavaScript has nothing to do with Java other than the first four characters of its name happen to be the same for some strange reason.

Java vs. JavaScript: What’s the Difference? (http://www.seguetech.com/blog/2013/02/15/java-vs-javascript)