Some tiny mods showing what I mean
option explicit
#include once "tinyptc.bi"
#include once "crt.bi"
const xres = 640
const yres = 480
Dim shared as Integer NS
NS=256
Dim shared as Integer x(ns),y(ns)
dim shared as integer r,g,b
Dim shared as Integer a,w
dim shared as integer g1(xres),h1(xres),j1(xres)
Dim shared as String key
Declare Sub DrawSnow
Declare Sub MoveSnow
Declare Sub DrawGround
dim shared height(xres) as integer
for a=0 to ns-1
x(a)=int(rnd(1)*xres)
y(a)=24+int(rnd(1)*(yres-48))
next
r=255:g=255:b=255
If(ptc_open("Christmas 'Snow' Demo",XRES,YRES)=0) Then
End -1
End If
Dim Shared sb(xres*yres)
#define PP(x,y,argb) sb(y*XRES+x)=argb
for a=0 to xres-1
g1(a)=0
h1(a)=5+int(rnd(1)*31)
j1(a)=-int(rnd(1)*7)+int(rnd(1)*14)
height(a)=420 'yres-1
next a
while key<>chr$(27)
key = inkey$()
DrawGround
DrawSnow
MoveSnow
ptc_update @sb(0)
memset @sb(0),0,xres*yres*4
Wend
Sub DrawSnow
for a=0 to ns-1
pp(x(a),g1(a),rgb(r,g,b))
g1(a)=g1(a)+h1(a)
x(a)=x(a)+j1(a)
if x(a)<0 then x(a)=x(a)=xres-15
if x(a)>xres-1 then x(a)=15
j1(a)=-int(rnd(1)*7)+int(rnd(1)*15)
next a
for a=0 to xres-1
for b=height(a) to yres-1
pp(a,b,rgb(r,g,b))
next
next
End Sub
Sub MoveSnow
for a=0 to ns-1
if g1(a)>height(x(a)) then
if height(x(a))>0 then
height(x(a)) = height(x(a))-1
end if
g1(a)=0
end if
rem if g1(a)>=yres-1 then g1(a)=0
rem for w=0 to 30000:next w ' yeah i know - very lazy!!!!!
rem yeah, shite, don't ever do that ;-)
next a
Sleep(16) 'if you must pause, do this
End Sub
Sub DrawGround
for a=0 to xres-1
for w=420 to yres-1
pp(a,w,rgb(r,g,b))
next w
next a
End Sub
The bar growing real quick on the left is because of the way you wrap the flakes going off the right hand side.
Jim