Thread Rating:
  • 1 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Warm Day
#4
Our world is unique, one earth but it has opposite weather between the northern and southern hemisphere  Big Grin
Sometimes, I just entertain myself with "the falling snow" code below ... 

Code:
' Sources :
' The falling snow is inspired from the moving stars in Blastemroids (Naalaa 6) by Marcus

'----------------
' INITIALIZATION
'----------------=
w = 640
h = 300

snow            = []
hill            = []           
myfont          = []

#win32
set window "Snow",w,h,false
set redraw off

'initial value
snow.dx         = 0
snow.dy         = 0
snow.img        = 0
myfont.img      = 0
myfont.size     = 50

'create a snow image from ellipses
create image snow.img, w,h
set image snow.img
set color 100,100, 100 'gray background
cls
for i = 0 to 500
    snow.radius = rnd(4)
    set color 255, 255, 255, rnd(256)
    draw ellipse rnd(w),rnd(h),snow.radius,snow.radius,1
next
set image primary

'load assets     
hill.img    = loadimage ("data_snow/landscape.png")
myfont.img  = createfont("Arial", myfont.size, 0,0,0,0)'name,size,bold,italic,underlined,smoothed

'--------------
' MAIN PROGRAM
'--------------       
do   
    set color 0,0,0;cls; set color 255,255,255'white
   
    'snow movement 1 pixel at a time diagonally, use 4 images as continuity
    snow.dx = (snow.dx + 1)%w
    snow.dy = (snow.dy + 1)%h
    draw image snow.img, -w + snow.dx    , snow.dy
    draw image snow.img,  0 + snow.dx    , snow.dy
    draw image snow.img, -w + snow.dx    , snow.dy - h
    draw image snow.img,  0 + snow.dx    , snow.dy - h
   
    'draw a static hill
    draw image hill.img,0,(0.625*h)
   
    set font myfont.img; set caret w/2,50; center "It's snowy..."

    wait 10
    redraw
until keydown(KEY_ESCAPE)


Attached Files
.zip   weather.zip (Size: 13.53 KB / Downloads: 2)
Reply


Messages In This Thread
Warm Day - by johnno56 - 02-04-2024, 06:04 PM
RE: Warm Day - by Marcus - 02-04-2024, 08:58 PM
RE: Warm Day - by johnno56 - 02-05-2024, 12:38 AM
RE: Warm Day - by 1micha.elok - 02-05-2024, 12:51 AM
RE: Warm Day - by johnno56 - 02-05-2024, 03:30 AM
RE: Warm Day - by Tomaaz - 02-05-2024, 09:12 AM
RE: Warm Day - by johnno56 - 02-05-2024, 05:17 PM
RE: Warm Day - by Tomaaz - 02-05-2024, 07:05 PM
RE: Warm Day - by Marcus - 02-06-2024, 05:10 PM
RE: Warm Day - by Tomaaz - 02-07-2024, 08:38 AM
RE: Warm Day - by Marcus - 02-07-2024, 01:49 PM
RE: Warm Day - by johnno56 - 02-07-2024, 11:07 AM
RE: Warm Day - by Tomaaz - 02-07-2024, 06:36 PM
RE: Warm Day - by Tomaaz - 02-07-2024, 03:42 PM
RE: Warm Day - by johnno56 - 02-07-2024, 10:58 PM
RE: Warm Day - by aliensoldier - 02-08-2024, 03:21 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)