Michael Fernie updated his Pop the Lock JSE-based game, to v1.1
-=-=-
Changed the color of the the target.
Added a triangle to it to make it stand out more.
Fixed all the text scaling issues.
Sweep movement is a slower and ramps up slower.
Sound Tracker changes the song every level 3rd level instead of every level.
Changed a few color choices to make them stand out more like the dial numbers.
Bumped up the version number to 1.1 and changed the date.
// Pop The Lock v1.1
// by Michael Fernie
// Created 6/17/2021
Symbol 0,"2__0_002_20_0_0,2_2,0_0_0220_0220_0@220_0,220_0/220_0,220_0/220_0,220_0/220_0,220_0/220_0,220_0/220_0,220_0/2_2/0_0!220_0?220_0.220_0/220_00220_0_220_220_0_00220/220_0220_0220?220_02.0_0220.220@2@0@220,2,0@20!20@2,002,0/220!220/2,002,0!2,0022002,0!2,002,0!2,0022002,0!2,002,0/220!220/2,0,220@20!20@220.220@2@0@220?220_2.0_220/220_220_220_220_0_220_00220_0/220_0.220_0?220_0!220_0,220_0@2_2?0_0_02_2,";
MelodyString="G16E32F32G16E16G32G32G32A32G16E32F32G16E32F32G16E16D32D32D32E32D16C16|G8G8F8F8E8E8F8E16F16|C8r16C16E16r16G16r16A16A+16A16F16G8r8|r1|[d]|C16G+16D16G+16C16G+16D16D16C16G+16D16G+16G+16C16D16C32D32|C16G+16C16G+16C16G+16C16G+16C16G+16C16G+16C16G+16C16C16|r8A4A4A4A8|r1|"
Graphics 1024, 720, 2
AA Off
#CONST $GAMESTATE_TITLE=0
#CONST $GAMESTATE_MAIN_GAME=1
#CONST $GAMESTATE_GAME_OVER=2
#CONST $GAMESTATE_LEVEL_COMPLETE=3
#CONST $SWEEP_SPEED_START=2.25
#CONST $SWEEP_SPEED_INC=0.035
Gosub ResetGame
//***** Main Loop *****
Repeat
if GameState==$GAMESTATE_TITLE then Gosub TitleScreen
if GameState==$GAMESTATE_MAIN_GAME then Gosub MainGame
if GameState==$GAMESTATE_LEVEL_COMPLETE then Gosub LevelComplete
if GameState==$GAMESTATE_GAME_OVER then Gosub GameOverScreen
Flip
Forever
//***** Title Screen *****
@TitleScreen
CLS
ResetDraw
SetColor Rand(0,255), Rand(0,255), Rand(0,255)
TextStr="*** Pop The Lock ***"
SetFontSizeFit(TextStr, ScreenWidth*0.75, ScreenHeight*0.75)
Text ScreenWidth*0.5, ScreenHeight*0.2, TextStr, 1
SetColor 255, 255, 255
TextStr="High Score: " + HighScore + " Level High: " + LevelHigh
SetFontSizeFit(TextStr, ScreenWidth*0.75, ScreenHeight*0.75)
Text ScreenWidth*0.5, (ScreenHeight*0.4)+68, TextStr, 1
SetFontSize 8
Text ScreenWidth-200, ScreenHeight-25, "Michael Fernie 6/17/21", 0
Text ScreenWidth-200, ScreenHeight-15, "JSE by Jayenkai", 0
if MouseHit() or KeyHit() or GamepadHit()
Gosub ResetGame
GameState=$GAMESTATE_MAIN_GAME
endif
SetSize 0.70
Starfield 2, 0, 0, 1
Return
//***** Reset Level *****
@ResetLevel
SeedRnd
//Fix For OR Bug
t1=0
if (Level mod 3==0) then t1=1
if (Level==1) then t1=1
if t1==1 then JMTrackr((Rand(1, 4)*5)+90, 0, MelodyString)
LockX=ScreenWidth()*0.5
LockY=ScreenHeight()-185
ClaspX=LockX-74
ClaspY=(LockY-LockH)+14
SweepAngle=0
TargetAngle=Rand(45, 105)
WipeAngle=0
SweepSpeed=$SWEEP_SPEED_START
Return
//***** Reset Game *****
@ResetGame
GameState=$GAMESTATE_TITLE
LockW=300
LockH=300
Level=1
LevelHigh=1
Score=0
HighScore=0
TargetsToGo=1
Gosub ResetLevel
if FileExists==1
LoadFile
HighScore=ReadFile(1)
LevelHigh=ReadFile(2)
endif
Return
//***** Main Game *****
@MainGame
CLS
ResetDraw
Gosub DrawLock
if MouseHit() or KeyHit() or GamepadHit()
dist=Distance(SweepX, SweepY, TargetX, TargetY)
if dist>18
GameState=$GAMESTATE_GAME_OVER
Return
else
SetSize 2
for p=0 to 5
ThrowParticle TargetX+Rnd(-30,30), TargetY+Rnd(-30,30), 7, Rnd(-15, 15), .35, 0, Rand(0, 9), 0
next
SetSize 1
Score=Score+(1*Level)
TargetsToGo=TargetsToGo-1
if TargetsToGo==0
GameState=$GAMESTATE_LEVEL_COMPLETE
Level=Level+1
TargetsToGo=Level
PlaySFX("Beeper_Rise", 1, 0.25)
Return
endif
PlaySFX("Beeper_Fruit_Bonus", 1, 0.25)
AngleOffset=Rand(35, 105)
SweepSpeed=-SweepSpeed
if (SweepSpeed<0)
TargetAngle=TargetAngle-AngleOffset
SweepSpeed=SweepSpeed-$SWEEP_SPEED_INC
else
TargetAngle=TargetAngle+AngleOffset
SweepSpeed=SweepSpeed+$SWEEP_SPEED_INC
endif
endif
Return
endif
Gosub UpdateSpinner
SetColor 180, 255, 180
SetFontSize 20
Text ScreenWidth*0.5, 30, "Score: " + Score + " Level: " + Level, 1
SetColor 0, 255, 0
SetFontSize 25
Text ScreenWidth*0.5, LockY-220, TargetsToGo, 1
SweepAngle=SweepAngle+SweepSpeed
//Fix For OR Bug
t1=(SweepSpeed < 0 and SweepAngle < (TargetAngle-10))
t2=(SweepSpeed > 0 and SweepAngle > (TargetAngle+10))
if t1 or t2
GameState=$GAMESTATE_GAME_OVER
endif
Return
//***** Draw Lock *****
@DrawLock
SetColor 255, 128, 0
SetThick 24
drawRect ClaspX, ClaspY, LockW*0.5, LockH*0.5, 0
SetColor 0, 0, 0
Rect ClaspX-20, ClaspY+137, 190, 40, 0
SetColor 255, 128, 0
SetThick 50
DrawOval LockX, LockY, LockW, LockH, 30
SetThick 20
DrawOval LockX, LockY, LockW*0.333, LockH*0.333, 12
SetFontSize 10
SetThick 2
SetColor 0, 255, 255
f=0
for d=0 to 35 step 5
dx=(Sin(f)*92)+LockX
dy=(0-(Cos(f)*92))+2+LockY
Text(dx, dy, d, 1)
f=f+45
next
SetThick 1
SetColor 255, 255, 255
for a=0 to 360 step 9
ss=Sin(a)
cc=Cos(a)
dx=(ss*105)+LockX
dy=(0-(cc*105))+LockY
Line dx+(ss*8), dy-(cc*8), dx+ss, dy-cc
next
Return
//***** Update Spinner *****
@UpdateSpinner
lineLen=150
targLen=172
TargetX=LockX+(Sin(TargetAngle)*lineLen)
TargetY=LockY-(Cos(TargetAngle)*lineLen)
ss=Sin(SweepAngle)
cc=Cos(SweepAngle)
SweepX=LockX+(ss*lineLen)
SweepY=LockY-(cc*lineLen)
SetColor 153, 0, 0
SetThick 8
SetSize 1.5
Oval TargetX, TargetY, 20, 20, 15
SetColor 0, 255, 0
Triangle TargetX, TargetY, 10, 10
SetSize 1
SetColor 0, 255, 0
SetThick 8
Line LockX+(ss*targLen), LockY-(cc*targLen), LockX+ss, LockY-cc
SetColor 0, 0, 255
SetThick 8
DrawOval SweepX, SweepY, 2, 2, 15
Return
//***** Level Complete ******
@LevelComplete
CLS
ResetDraw
Gosub DrawLock
dy=Abs(ClaspY-LockY)
if dy<=320
ClaspY=ClaspY-10
if dy==306
KillParticles
PlaySFX("Metal_3", 1, 1.0)
endif
else
ClaspX=ClaspX-45
LockX=LockX-45
if LockX<-255
Wait .25
Gosub ResetLevel
GameState=$GAMESTATE_MAIN_GAME
endif
endif
Return
//***** Game Over Screen *****
@GameOverScreen
if WipeAngle==0
PlaySFX("Explode_High_4", 0.5)
KillParticles
if Score>HighScore then HighScore=Score
if Level>LevelHigh then LevelHigh=Level
WriteFile 1, HighScore
WriteFile 2, LevelHigh
SaveFile
endif
if WipeAngle <> 181
SetThick 6
WipeAngle=0
l=320
w=0
SetColor 0, 0, 0
repeat
ss=Sin(WipeAngle)
cc=Cos(WipeAngle)
ss2=Sin(WipeAngle+180)
cc2=Cos(WipeAngle+180)
dx=ss+LockX
dy=(0-cc)+LockY
Line dx+(ss*l), dy-(cc*l), dx+ss, dy-cc
w=w+1
if (w>1)
WipeAngle=WipeAngle+1
w=0
endif
dx2=ss2+LockX
dy2=(0-cc2)+LockY
Line dx2+(ss2*l), dy2-(cc2*l), dx2+(ss2), dy2-(cc2)
if WipeAngle mod 10==0 then Flip
until WipeAngle>180
Wait .25
else
CLS
ResetDraw
TextStr="Score: " + Score + " High Score: " + HighScore + " Level: " + Level + " Level High: " + LevelHigh
SetFontSizeFit(TextStr, ScreenWidth*0.75, ScreenHeight*0.75)
Text ScreenWidth*0.5, (ScreenHeight*0.4)+68, TextStr, 1
SetColor Rand(0,255), Rand(0,255), Rand(0,255)
Text ScreenWidth*0.5, (ScreenHeight*0.2)+92, "<<< Game Over! >>>", 1
if MouseHit() or KeyHit() or GamepadHit()
Gosub ResetGame
GameState=$GAMESTATE_TITLE_SCREEN
endif
endif
SetSize 0.70
Starfield 2, 0, 0, 1
Return