New games every week!
JSE - New To The Todo Blog
2nd July 2021
I've opted to add a couple of new items to the ToDo list.

-=-=-

Yesterday I wondered how far I've come.
After the test from the Usborne book a couple of days ago, I found myself wanting to try the same kind of thing with a bit of Blitz2D code.
I headed off to the First Wednesday Workshop page, and grabbed the very first bit of code on there.

; Ball Up Graphics 640,480,0,2 SetBuffer BackBuffer() Dim array(2000) .restart SeedRnd MilliSecs() x=9 For y=1 To 2000 array(y)=x*32 x=x+Rand(-3,3) If x<0 Then x=Rand(0,2) If x>19 Then x=Rand(17,19) Next bally=0 ballx=320 jumparc=0 scry=0 py=0 Repeat jumparc=jumparc+4 If jumparc=>180 Then jumparc=jumparc-180 Cls Color 140,80,40 baty=(446-bally)-(Sin(jumparc)*180) baty=baty+scry Oval ballx,baty,16,16 ballx=ballx+((KeyDown(205)-KeyDown(203))*4) Color 80,140,40 If bally>-32 Then Rect 0,460+bally,640,32 land=1 For x=1 To 2000 atx=array(x) aty=(460-(x*140))+scry If aty>0 And aty<480 Rect atx,aty,32,32 If jumparc>89 And jumparc<110 And aty>baty And aty<baty+60 And atx<ballx+8 And atx+32>ballx+8 py=py+140 EndIf If jumparc=0 And aty>baty-16 And (atx>ballx+8 Or atx+32<ballx+8) Then land=0 EndIf Next If land=0 Then dead=1 If py<>0 Then scry=scry+20:bally=bally+20:py=py-20 Flip If KeyDown(1) Then dead=9 Until dead>0 Repeat Cls If dead=9 Then End If dead=1 Then Text 320,240,"You Fell",1,1:Text 320,280,"Hit Space to Try Again",1,1 Flip Until KeyDown(57) dead=0 Goto restart


It's one of my own little games, and features a ball bouncing up the screen.
The very first line is broken, because Blitz2D uses ; to symbolise commented lines, whilst JSE uses //
But, having changed that, everything else *appears* to work, though gameplay wise, it's very very broken.
Still, the ball bounces.. once.. and the loop runs, albeit extremely slowly.
Upon hitting the ground, the game is over.
Hmm..

I wasn't quite happy with how it runs, so I switched over to Windows, opened up Blitz and popped the code in there, to be sure..
There, it runs entirely differently.
The ball bounces endlessly on the ground, and you can hop up and continue to bounce on the boxes as you go.

It's obvious, then, that although the two languages are "mildly" compatible, there's definitely something going awry in there. Somewhere.

I then focussed on fiddling with a few commands, neatening little bits of the syntax up, but most importantly, ensuring I didn't break anything else as I go.
I also added the KeyDown command whilst doing this, since it seemed somewhat important when running Blitz2D code.

Meanwhile...


This test has shown up a rather important flaw.
If you try to copy any of the other first Wednesday Workshop examples, they all have a command that's very obviously missing.

Functions


Defining and calling functions should definitely be part of the language.
I've been putting this one off for quite a while, but it's kinda important, and trying to copy+paste from SoCoder showed this up quite a bit.
Every example used them.
Everything!!
So. Yeah, that definitely needs doing.

Functions are now on the todo list.
My mind is currently bubbling away trying to figure out the best way to do this, using the techniques that I've already coded.
Local/Global issues are likely to start to crop up at this point, so I'll have to be very careful with how I'm working with these.
Also Stack Overflows will probably crop up a LOT more often!
Hmm...

Types/Objects/Classes


Lots of usage of Types in the Workshop, too.
Fundamentally, I expect that Types would work a bit like Arrays, but instead of having numbered elements, you have words linked to each one. I expect these won't be "too" hard, but doing more complex Objects would probably be a lot tougher. Giving objects internal functions and the like, would be rather tricky to handle, especially since I haven't coded standard functions yet!!

For now I'll likely stick to how Blitz2D/3D handles Types. Those seem simple enough. I think..
.. Maybe!

Fix Ball-Up


Since Ball-Up, as simplistic a game as it is, isn't actually working, I still have some work to do with the underlying code.
Something isn't being understood somewhere, and it's a good idea to fix up these issues.
Having an obviously broken bit example to focus on will (hopefully) be a good thing to aim for.

And so, the ToDo list grows.
The journey is far from over..


// Ball Up // Changes from Blitz2D code // 1. if ='s changed to if =='s // 2. ; based REM's changed to //'s // 3. Slight realignment in the Oval command to account for Ovals being drawn from the middle, not the top-left. // 4. For-Loop reduced to only draw the nearby squares, not the whole 2000 squares. JSE's still quite slow!! // 5. Main floor rewritten because it didn't work once the For-Loop optimisation was changed! // 6. Changed Keydown(59) to Keydown(32) Graphics 640,480,0,2 SetBuffer BackBuffer() Dim array(2000) .restart SeedRnd MilliSecs() x=9 For y=1 To 2000 array(y)=x*32 x=x+Rand(-3,3) If x<0 Then x=Rand(0,2) If x>19 Then x=Rand(17,19) Next bally=0 ballx=320 jumparc=0 scry=0 py=0 Repeat jumparc=jumparc+4 If jumparc=>180 Then jumparc=jumparc-180 Cls Color 140,80,40 baty=(446-bally)-(Sin(jumparc)*180) baty=baty+scry Oval ballx+8,baty+8,16,16 ballx=ballx+((KeyDown(205)-KeyDown(203))*4) Color 80,140,40 If bally>-32 Then Rect 0,460+bally,640,32 land=1 t=Floor(scry/140) if t>1995 then t=1995 b=t+5 For x=t to b atx=array(x) aty=(460-(x*140))+scry If aty>0 And aty<480 Rect atx,aty,32,32 If jumparc>89 And jumparc<110 And aty>baty And aty<baty+60 And atx<ballx+8 And atx+32>ballx+8 py=py+140 EndIf If jumparc==0 And aty>baty-16 And (atx>ballx+8 Or atx+32<ballx+8) Then land=0 EndIf Next if jumparc==0 and scry==0 then land=1 If land==0 Then dead=1 If py<>0 Then scry=scry+20:bally=bally+20:py=py-20 Flip If KeyDown(0) Then dead=9 Until dead>0 Repeat Cls If dead==9 Then End If dead==1 Then Text 320,240,"You Fell",1,1:Text 320,280,"Hit Space to Try Again",1,1 Flip Until KeyDown(32) dead=0 Goto restart

Views 68, Upvotes 8  
Daily Blog , Jse , Todo
New games every week!
Site credits : PHP script, Blog posts, Games, Music, Pixelart, Poems and More : Jayenkai
(c) Jayenkai 2023 and onwards, RSS feed

Blog - JSE - New To The Todo - AGameAWeek