New games every week!
JSE - Warning : Else Blog
14th May 2021
Else is a bit broken..

-=-=-

Noticed this tonight under .. some rather simple testing that I probably should've done earlier!!

If this
do this
else
do that
endif

works fine..
but this does not..

if this
do this
if another then do that
else
do the third
endif

An else asks "was the previous IF false?"
And that made sense in my head when I coded the functionality, but now that I'm actually using it, it's obvious that that isn't the way Else oughta work.
In the above example, if "this" is true, but "another" is false, then the else section will be performed because the "previous" if was false, even though the original if was true.

Essentially it'll "do this", and also "do the third"..
It shouldn't do that!


For now, probably best to avoid else's!
Sorry about that. I'll fix it once my head's in the mood to tackle it properly!

In the meantime, however, I've been optimising, and you should find that standard if's now run a little faster, since I've finally got around to adding jumps into the mix.
So..
um..
\o/yeay\o/

Meanwhile..



// Cardagain and again and again and again // by Jayenkai // Created 2021/5/14 Symbol 0,"1__0@v0_0?v,0_0.v,0_0,v?0_00v?0_0v/0_v/0@v_0/v_0/v_0@v/0_0v?0_0.v0_0.v?"; Symbol 1,"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;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;_;;"; Symbol 2,"1__0_0_0_0_0_0_0_0_0_06_6,0,6_6?006_6?006_6?006_6?006_6?006_6?006_6?006_6?006_6?006_6?"; Symbol 3,"0__5_0!550!550!550!550!550!5_"; Symbol 4,"0__00Q.0,Q0.Q0Q0!QQ0!QQ0!QQ0!Q0Q0.Q0,Q."; Symbol 5,"0__0,WW0!WW0?W00W0.W00W0,W0.W00W0.W,0!W_"; Symbol 6,"1__0?J!0@J_J0?J,0!J,0,J,0@J,00JJ0_0JJ0JJ0_0,J.0_0,J.0_0,J.0_0,J.0_0,J.0_0,JJ0JJ0_0JJ00J,0@J,0,J,0!J,0?J_J0@J!"; Symbol 7,"0__C0!C0C0.C0,C00C0?CC0!CC0?C00C0,C0.C0C0!C"; Symbol 8,"0__0,ss0!ss0!ss0,s_s/0,ss0!ss0!ss"; Symbol 9,"0__0d0.d0,d00d0?dd0?d00d0.d00d0?dd0?d00d0,d0.d"; Symbol 10,"0__0X0.X00X,00X00X0.X00X0.X00X0.X00X0.X00X00X,00X0.X"; Symbol 11,"0__0050050,500500550050050,50050,500500550050050,50050,5005005"; Symbol 12,"0__0_KK0K0K00KK0K0K0?K0K00K.0K0/K00K!"; Symbol 13,"0__0_00RR0!RR0.R!00R0.R00R0.R00R!"; Symbol 14,"0__0_6!0060.6006,0060/6006!006"; Symbol 15,"0__0_f!0.ff0.f!0_0f!0,f00f"; Symbol 16,"0__s0!s0s0.s0,s00s0.s00s0.s00s0.s00s0,s0.s0s0!s"; Symbol 17,"1__0_0_04,0.4,0?4224400422440,424!24?04_4_4_4_4_4_4_4_4@04_4?004_4?0,4_4,0?4_40/4@0_4!0_004."; Dim order(50) Graphics 480,560,1 AntiAlias False Debugmode on Highscore=0 Score=0 ShowScore=0 Ingame=0 SetTilemapSize(5,5) mdis=1 LogoHigh=1 Repeat CLS 40,80,120;ResestDraw if LogoHigh>0.5 then LogoHigh=0.5 if LogoHigh<0.25 then LogoHigh=0.25 if MouseDown<1 then mdis=0 if Ingame==0 then Gosub Menu:LogoHigh=LogoHigh+0.01 if Ingame==1 then Gosub Game:LogoHigh=LogoHigh-0.01 Flip Forever .DrawLogo SetSize 6,6 DrawImg ScreenWidth/2-6,(ScreenHeight*LogoHigh)-4,0 SetSize 1,1:SetFontSize 64 Text ScreenWidth/2,(ScreenHeight*LogoHigh),"Card gain",1 SetFontSize 96 Text ScreenWidth/2,(ScreenHeight*LogoHigh),"A",1 ResetDraw showscore=showscore-((showscore-score)/5) if Abs(showscore-score)<1 then showscore=score ResetDraw SetCol 180,255,180,0.7:SetFontSize 32 Text jscrw/2,16,Right$("00000000"+Floor(showscore),8),1 SetCol 180,200,255,0.5 Text jscrw/2,jscrh-16,"High : "+Right$("00000000"+Floor(Highscore),8),1 return .Menu ResetDraw Gosub DrawLogo if mdis==0 and MouseDown>0 mdis=1 Gosub LoadGame endif if Score>Highscore then Highscore=Score return .LoadGame for x=0 to 4 for y=0 to 4 SetTile(x,y,Neg(1)) next next Ingame=1 moving=8 lives=3 tick=0 stage=0 step=0 upto=0 playto=0 score=0 combo=0 showscore=0 level=0 shuffle=0 return .Game moving=moving-1 if moving<1 then moving=0 ResetDraw SetAlpha 0.1 Gosub DrawLogo ResetDraw canplay=0 if step==4 then canplay=1 for x=0 to 4 for y=4 to 0 step -1 c=GetTile(x,y) if c>Neg(1) sat=0 sx=GetTileOffsetX(x,y) sy=GetTileOffsetY(x,y) sx=sx*0.84 if Abs(sx)<0.5 then sx=0 sy=sy*0.84 if Abs(sy)<0.5 then sy=0 SetTileOffset(x,y,sx,sy) sp=GetTileScaleX(x,y) if sx==0 and sy==0 if sp<0.25 sp=(sp+Rnd(0.015,0.05))%1 moving=4 if sp>=0.25 sp=0.25 endif endif if sp>0.25 and sp<0.75 moving=4 sp=(sp+Rnd(0.015,0.05))%1 if sp>=0.75 then sp=0.75 endif if sp>0.75 moving=4 sp=(sp+Rnd(0.015,0.05))%1 endif if sp>=1 then sp=sp-1 endif sc=Sin(sp*360) dx=(x*80+80)+sx dy=(y*100+75)+sy SetSize sc*2,2 DrawImg(dx,dy-30,1) if sp<=0.5 then DrawImg(dx,dy-30,2) SetSize sc*2,Neg(2) DrawImg(dx,dy+30,1) if sp<=0.5 then DrawImg(dx,dy+30,2) if sp>=0.5 then DrawImg(dx,dy,c+3) if sp==0.25 and moving==0 and canplay==1 if Abs(dx-MouseX())<35 and Abs(dy-MouseY())<45 if MouseDown()>0 and mdis==0 SetSize 1,1 if sp==0.25 then sp=0.26 order(playto+25)=c if order(playto+25)==order(playto) then PlaySFX("Beeper_4tone_Up"):combo=combo+1:score=score+(combo*combo) if order(playto+25)<>order(playto) then PlaySFX("Beeper_4tone_Down"):combo=0 playto=playto+1 endif endif endif SetTileScale(x,y,sp,1) endif ResetDraw() sx=GetTileOffsetX(x,y) sy=GetTileOffsetY(x,y) dx=(x*80+80)+sx dy=(y*100+75)+sy next next if moving==0 then tick=tick+1 if ((step==0 or step==1) and tick>30) repeat x=Rand(0,4) y=Rand(0,4) c=0 if x>0 and GetTile(x-1,y)>Neg(1) then c=1 if y>0 and GetTile(x,y-1)>Neg(1) then c=1 if x<4 and GetTile(x+1,y)>Neg(1) then c=1 if y<4 and GetTile(x,y+1)>Neg(1) then c=1 if GetTile(x,y)>Neg(1) then x=Neg(1) if stage==0 and step==0 then x=2:y=2:c=1 if c==0 then x=Neg(1) until x>Neg(1) PlaySFX("Beeper_Fruit_Extra") SetTile(x,y,stage) SetTileScale(x,y,0.251,1) SetTileOffset(x,y,0,1024) step=step+1:tick=0 if step==2 and stage==0 stage=1:step=0 endif endif if step==2 and tick>90 for x=0 to 4 for y=4 to 0 step -1 sx=GetTileScale(x,y) SetTileScale(x,y,sx+0.05,1) next next PlaySFX("Beeper_Jingle_Up") step=3 for m=0 to stage order(m)=(m+1)-1 // That's an odd issue. next txt="" for m=0 to stage txt=txt+","+order(m) next for m=0 to stage r=Rand(0,stage) t=order(m) order(m)=order(r) order(r)=t order(m+25)=Neg(1) next txt="" for m=0 to stage txt=txt+","+order(m) next tick=0 upto=0 playto=0 endif if step==3 and tick>12 find=order(upto) for q=0 to 10 x=Rand(0,4):y=Rand(0,4) if GetTile(x,y)==find PlaySFX("Beeper_2tone_Up") tick=0 q=20 sx=GetTileScale(x,y) SetTileScale(x,y,0.26,1) upto=upto+1 if upto>stage then step=4 endif next endif txt="" txt2="" for m=0 to stage txt=txt+","+order(m) txt2=txt2+","+order(m+25) next if step==4 and upto==playto if txt==txt2 PlaySFX("Beeper_Rise",1) level=level+1 step=2:tick=0 if level>2 then step=5 endif if txt<>txt2 PlaySFX("Beeper_Fall",1) lives=lives-1 level=level-1 if level<0 then level=0 if lives>Neg(1) then step=2 if lives<0 then step=99 tick=0 endif endif if step==5 shuffle=shuffle+1 if shuffle<3 step=6 level=0 endif if shuffle>=3 and stage>12 step=2 level=0 endif if shuffle>=3 and stage<13 stage=stage+1 shuffle=0 level=0 step=0 endif endif if step==6 and tick>30 for m=0 to 200 x1=Rand(0,4) y1=Rand(0,4) f=Rand(0,1) if f==0 if y1==0 then y1=1 x2=x1 y2=y1-1 endif if f==1 if x1==0 then x1=1 x2=x1-1 y2=y1 endif d=GetTile(x1,y1) e=GetTile(x2,y2) if d>=0 and e>=0 if d<>e dx=(x1-x2)*80 dy=(y1-y2)*100 SetTile(x1,y1,e) SetTile(x2,y2,d) SetTileOffset(x1,y1,Neg(dx),Neg(dy)) SetTileOffset(x2,y2,dx,dy) tick=0 Shuffle=Shuffle+1 m=500 if Shuffle>3 then step=2 PlaySFX("Beeper_Jump") endif endif next endif if lives<0 and tick==60 then PlaySFX("Beeper_Toot_Lose",1) if lives<0 and tick>120 then Ingame=0 for x=0 to 2 SetAlpha 1 SetCol 80,0,0 SetSize 1 if x<level then SetCol 80,180,80 Rect ((jscrw-140)+(x*12),8,8,16)) SetSize 0.5 if x+1>Lives then SetAlpha 0.3 DrawImg 100+x*18,16,17 next return

Views 129, Upvotes 22  
Jse , Cardagain
New games every week!
Site credits : Jayenkai, one crazy fool who has far too much time on his hands.
(c) Jayenkai 2023 and onwards, RSS feed 82

Blog - JSE - Warning : Else - AGameAWeek