No.. "Array!!!"
-=-=-
// SpikeDislike v1.0
// by Jayenkai
// Created 2021/4/13
Symbol 0,"0__20!203044030,30030,404404004044040,30030,304403020!2";
Symbol 1,"0__00A,B0,A9AB,0A9AB.CAAB?CAAB?CB!CD0B.CD0,C,D";
Symbol 2,"2__0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0_0/y0_0_0_0_0_0_0_;0_0_0_0y0;0;0y0_0_0_0;0_0_0_0_0_0_0_y";
Graphics 1024,720,2; AA Off
Dim Spike(20)
Dim SpikePos(20)
DebugMode 1
Highscore=0
Gosub Restart
Repeat
Button=Gamepad(ButtonA) or Gamepad(ButtonB) or Gamepad(ButtonRight)>0 or MouseDown()
if Button==0 then bdis=0
If Ingame==0 then Gosub Menu
If Ingame==1 then Gosub Game
Flip
Forever
@Menu
if Score>Highscore then Highscore=Score
ResetDraw
SetCol 255,100,100
SetFontSize 48
Text ScreenWidth*0.5-64,(ScreenHeight*0.4)+128,"Spike",1
Text ScreenWidth*0.5+64,(ScreenHeight*0.4)+160,"Dislike",1
SetCol 255,255,255
Text ScreenWidth*0.5,(ScreenHeight*0.4)+192,"Highscore : "+Highscore,1
SetSize 6,6
DrawImg ScreenWidth*0.5,ScreenHeight*0.4,0,0
if Button==1 and bdis==0 then Gosub Restart
Return
@Restart
Passed=0
Score=0
ScoreShow=0
Combo=0
ComboTick=0
SuperCombo=0
Gap=360
Speed=0.6
Bounce=3.5
BounceRot=0
SpikesMade=0
BNoise=0
Delta=1
SpikeScroll=640
Ingame=1
bdis=1
For n=0 to 10
SeedRnd SpikesMade
Spike(n)=Rand(0,7)
SpikesMade=SpikesMade+1
SpikePos(n)=SpikesMade
next
return
@Game
CLS;ResetDraw
ScoreShow=ScoreShow-((ScoreShow-Score)/5)
if Abs(ScoreShow-Score)<1 then ScoreShow=Score
if Button<0.5 then SuperCombo=0
dx=0
if Button>0.5 and bdis==0 then dx=Neg(-16)
Starfield dx*0.5,0,2
SpikeScroll=SpikeScroll+dx
SetRot 0
was=Abs(Sin(BounceRot) * (32*8))
BounceRot=BounceRot+(Bounce*Delta)
is=Abs(Sin(BounceRot) * (32*8))
if is<was then BNoise=0
if is>was and BNoise==0 then PlaySFX("Beeper_Jingle_Up",1):BNoise=1
dead=0
SetFontSize 48
SetCol 180,255,180
Text ScreenWidth/2,32,Right("000000000000"+Floor(ScoreShow),12),1
ComboTick=ComboTick-2.5
if ComboTick<0 and Combo>0 thenPlaySFX("Beeper_2tone_Down"):Combo=0:SuperCombo=0
endif
SetAlpha 0.5
if ComboTick>0 then Rect ScreenWidth/2,48,ComboTick*2,16,1
SetAlpha 1
SetCol 0,96,0
Rect 0,((ScreenHeight()-64)+32),ScreenWidth(),8
SetCol 80,40,0
Rect 0,((ScreenHeight()-64)+40),ScreenWidth(),100
SetCol 255,180,96
SetSize 2
DrawImg 100,((ScreenHeight()-64)-is),1,0;
px=100;py=((ScreenHeight()-64)-is);
if SpikeScroll<0-Gap
For n=0 to 10
h=Spike(n+1)
Spike(n)=h
h=SpikePos(n+1)
SpikePos(n)=h
Next
SeedRnd SpikesMade
Spike(10)=Rand(0,7)
SpikesMade=SpikesMade+1
SpikePos(10)=SpikesMade
SpikeScroll=SpikeScroll+Gap
endif
// Draw Spikes
For n=0 to 10
x=(Gap*n)+SpikeScroll
h=Spike(n)
y=(ScreenHeight()-64)-(h*32)
DrawImg(x,y,0,h)
h=SpikePos(n);SetFontSize 12
Text(x,ScreenHeight()-16,h,1)
d=Pyth(x,y,px,py)
if d<32 then dead=1
d=Pyth(x-32,y-32,px,py)
if d<31 then dead=1
d=Pyth(x+32,y-32,px,py)
if d<31 then dead=1
d=Pyth(x-32,y+32,px,py)
if d<31 then dead=1
d=Pyth(x+32,y+32,px,py)
if d<31 then dead=1
if x<68 and h>Passed then
Passed=h
Combo=Combo+1
ComboTick=160
SuperCombo=SuperCombo+1
Score=Score+(Combo*SuperCombo)
pitch=((Combo)/20)+1
if SuperCombo<2 then PlaySFX("beeper_2tone_up",pitch)
if SuperCombo>1 then PlaySFX("beeper_4tone_up",pitch)
endif
Next
If dead==1 then bdis=1:Ingame=0:PlaySFX("Explode_Low_1"):PlaySFX("Explode_Low_2"):PlaySFX("Beeper_Fall")
Return
Yesterday I did SpikeDislike using the Tilemap functionality.
Today I thought "Hey, hang on.. Why don't I ACTUALLY do that?"
I set about making a couple of new behind the scenes commands, GetArray and SetArray.
Once the script comes across a Dim, it scans the rest of the code for that variable name, converting it from, say
a(5)="Hello" to
SetArray("Hello","a",5);
If you'd like, you can use that function in that way, but it's nasty, so I wouldn't bother!!
Suffice to say, a(5)="Hello" now works a treat, as does Print a(5).
Oddities might ensue if you try to do complex things with arrays, but .. they should at least function for the basic stuff.
You can dim an array with up to 4 dimensions. I can't think of a need for any more than that, especially not in a fairly simplistic scripting language like this. But if YOU can think of any reasons to have more than 4 dimensions, please do let me know.
(Plus it's still kinda slow looping through all of those dimensions, so.. probably best not to!)
Rightyoo.. Give it a go, and let me know how you get on.
I now need to go and write up today's additions for the Command List page thing.