News:

Welcome to RetroCoders Community

Main Menu

Rain

Started by johnno56, Mar 20, 2023, 09:42 AM

Previous topic - Next topic

johnno56

This was a simple rain demo that I had for rcbasic... Testing "line numbers free"... lol

This really runs better with the background sound track... For the time being, just imagine a distant thunderstorm with the sound of rain falling on water... *sigh*

xmax = 640
ymax = 512

screen _newimage(xmax, ymax, 32)
cls

Rem Insert distant storm and rain track here...

md = 20

Dim dropX(md)
Dim dropY(md)
Dim dropR(md)

for a = 1 to md
	dropX(a) = int(rnd(1)*640)
	dropY(a) = int(rnd(1)*512)
	dropR(a) = int(rnd(1)*40)
next a

while inkey$ = ""
	line(0,0)-(_width,_height),_rgb32(0,0,50),bf
	
	for a = 1 to md
		bri = 250 - dropR(a) * 5
		circle(dropX(a),dropY(a)),dropR(a), _rgb32(0,0,bri)
		dropR(a)=dropR(a)+1
		if dropR(a)>40 then
			dropX(a) = int(rnd(1)*640)
			dropY(a) = int(rnd(1)*512)
			dropR(a) = 0
		end if
	next a
	_delay 0.03
	_display
wend
May your journey be free of incident.  Live long and prosper.

CharlieJV

Quote from: johnno56 on Mar 20, 2023, 09:42 AMThis was a simple rain demo that I had for rcbasic... Testing "line numbers free"... lol

This really runs better with the background sound track... For the time being, just imagine a distant thunderstorm with the sound of rain falling on water... *sigh*

xmax = 640
ymax = 512

screen _newimage(xmax, ymax, 32)
cls

Rem Insert distant storm and rain track here...

md = 20

Dim dropX(md)
Dim dropY(md)
Dim dropR(md)

for a = 1 to md
	dropX(a) = int(rnd(1)*640)
	dropY(a) = int(rnd(1)*512)
	dropR(a) = int(rnd(1)*40)
next a

while inkey$ = ""
	line(0,0)-(_width,_height),_rgb32(0,0,50),bf
	
	for a = 1 to md
		bri = 250 - dropR(a) * 5
		circle(dropX(a),dropY(a)),dropR(a), _rgb32(0,0,bri)
		dropR(a)=dropR(a)+1
		if dropR(a)>40 then
			dropX(a) = int(rnd(1)*640)
			dropY(a) = int(rnd(1)*512)
			dropR(a) = 0
		end if
	next a
	_delay 0.03
	_display
wend

Hey, that's pretty awesome.  Thanks for giving BAM a whirl.

How did it go?  Did you save it to a local drive ?

Did you find anything off-putting, unclear, or hard to find?

johnno56

Still trying to get my head around 'dev' and 'prod' for saving but I will eventually work it out.

No problems with the coding. The usual 'How is rnd() done?' but, other than that, all went well. I miss having the backing track, but hey, we go with what works.

I noticed, apart from loading and playing wave files etc, that there does not seem to be a method of handling fonts. Are there any plans to include these in the future? Hmm... I suppose if you added everything we are used to, BAM will no longer be unique, but another version of this basic or that basic... lol

I am actually going through some programs and listings of stuff I would like to try... No promises on anything too soon... lol  I am not 'that' quick off the mark... lol
May your journey be free of incident.  Live long and prosper.

CharlieJV

Quote from: johnno56 on Mar 21, 2023, 12:23 AMStill trying to get my head around 'dev' and 'prod' for saving but I will eventually work it out.

Dev and prod a a very minimalistic implementation of https://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_production.

A new program starts off as a copy of "New.BAS", New.BAS being a template for all new programs with maybe a header comment or whatever else you most often want in any new program.

Your new program starts off in "PRODuction" level, until you edit it.  The second you edit it, the program goes into "DEVelopment" level.  When you are happy with your program, promote it to "PRODuction level".

While a program is in "DEV", the "PROD" code is still there under the hood.  So you can compare your DEV code to PROD code at any time, even export both versions, and undo the DEV work and return to PRODunction version.


Fonts are a big headache for BAM, as per the wwwBASIC setup.  Fonts are old-school 8x8 pixel characters.

To really understand the implementation of fonts, I dug into the code and created an alternative font.


wwwBASIC uses an HTML canvas element to render the console window.  By design, that is a louzy setup for text, but the only choice for graphics.  Text is painted on the screen, as per the screen mode pixel width and height, but then the entire screen and text/graphics drawn on that HTML canvas element get rescaled to fit the size of the browser window.

Go to the Project menu, and click on run-time properties.  You can choose one of the two available fonts and also the "Enable Image Smoothing" option.  Turning off that option produced, I find, better text.

In any screen mode, you can play with the "WIDTH" statement to adjust the width of fonts in any window.  That can be used in any screen mode, and you aren't limited to just the 40 and 80 columns.

The screen modes: https://basicanywheremachine.neocities.org/BAM_ProgReference#SCREEN%20Modes


CharlieJV

A demo of how the "WIDTH" statement (to set the number of columns for any screen mode and for any number of columns) impacts the appearance of the built-in wwwBASIC font.

https://basicanywheremachine.neocities.org/sample_programs/Loop%20Through%20Screen%20Modes.prod.run

Note how, as per GW-BASIC compatibility, adjusting WIDTH impacts not only text, but also graphics.

As per GW-BASIC, a circle will look like a circle regardless of screen mode and WIDTH.

However, other kinds of graphics get proportionally readjusted.

johnno56

Thank you. Much appreciated...

J
May your journey be free of incident.  Live long and prosper.