New games every week!
JSE - Goto 10 Blog
8th May 2021
10 Print "Hello World"
20 Goto 10

-=-=-

I took a day off from trying to figure out how best to do Arrays, so instead spent today adding a bunch of random commands to JSE.

The star of the show is, of course, Goto! Everybody's favourite command they love to hate.

Goto is in, as is Gosub. Gosub can return. Goto can't... Though you can try, and things will probably go awry as a result!

For Labels, use a symbol at the start of a line.
You can use either @, . or #, to allow compatibility with SmileBASIC (@), Blitz2D/3D (.) and BlitzMax (#)
For an extra retro vibe, shove in a line number, instead!

5 Graphics 512,512,0 10 Print "Hello World" 11 a=Rand(1,10) 12 if a==1 then Gosub SmileBASICStyleLabel 13 if a==3 then Gosub BlitzStyleLabel 14 if a==5 then Gosub BMaxStyleLabel 15 if a==7 then Gosub 30 16 Wait 0.1 20 Goto 10 30 Print "Hello >> Line Thirty"; Return @SmileBASICStyleLabel Print "Hello >> SmileBASIC";Return .BlitzStyleLabel Print "Hello >> Blitz";Return #BMaxStyleLabel Print "Hello >> BlitzMax";Return


Functions are coming later. I was going to throw them in, but it turned out to be a more complicated task than I thought it was going to be!


Additional commands for today include..
Return to return from a Gosub.
Instr to seek strings within strings. eg Instr("Eleven","v") returns 3. (It's zero based, btw!!)
Perc(value, total) returns the percentage of value, based on total.. eg Perc(30,60) returns 50%

WaitMouse, waits for a mouse click
WaitKey, waits for a keypress.
WaitGamepad, waits for a Gamepad face button.
All three will also be triggered by the touchscreen, in case (on a mobile) the user doesn't have a keyboard/gamepad attached.
MouseHit, KeyHit, GamepadHit show 1 when a similar hit has occurred.

Graphics commands
Plot to plot points (beware the scaling oddities, though!)
Move to move the graphics cursor
LineTo to draw from the graphics cursor to the new position

PlotR, MoveR, LineR do the same things, but are all relative to the current graphics cursor's position, so for example PlotR 1,0 will plot 1 pixel to the right.

End.. Ends things!
Views 110, Upvotes 16  
Jse
New games every week!
Site credits : If you can see it, Jayenkai did it.
(c) Jayenkai 2023 and onwards, RSS feed 91

Blog - JSE - Goto 10 - AGameAWeek