% Collision detection for the ground - Mushroom things
procedure chkForGroundGoomba
loop
if goombaPosY (curItemPosition) < 80 then
if mapPartsArray (curItemPosition, 6) = "0" then
if (curItemPosition * 30 - xpos) > groundColFor1 then
if (curItemPosition * 30 - xpos) < groundColFor2 then
goombaGroundHeight (curItemPosition) := -70
exit when 1 = 1
else
goombaGroundHeight (curItemPosition) := 60
end if
end if
end if
end if
curItemPosition := curItemPosition + 1
exit when curItemPosition = mapLength
end loop
curItemPosition := 1
loop
if goombaPosY (curItemPosition) < goombaGroundHeight (curItemPosition) then
goombaVelY (curItemPosition) := 0
goombaPosY (curItemPosition) := goombaGroundHeight (curItemPosition)
end if
curItemPosition := curItemPosition + 1
exit when curItemPosition = mapLength
end loop
end chkForGroundGoomba
% Checking for blocks / coin blocks on the first level.
procedure chkForLvl1Block
loop
curItemPosition := curItemPosition + 1
if ypos > 149 then
if mapPartsArray (curItemPosition, 2) = "1" or mapPartsArray (curItemPosition, 3) = "1" then
if (curItemPosition * 30 - xpos) > blockCol1 then
if (curItemPosition * 30 - xpos) < blockCol2 then
groundHeight := 150
exit when 1 = 1
else
groundHeight := 60
end if
end if
end if
end if
if ypos = 80 then
if mapPartsArray (curItemPosition, 2) = "1" or mapPartsArray (curItemPosition, 3) = "1" then
if (curItemPosition * 30 - xpos) > blockCol1 then
if (curItemPosition * 30 - xpos) < blockCol2 then
yvel := -2
exit when 1 = 1
else
end if
end if
end if
end if
if curItemPosition = mapLength then
exit when 1 = 1
end if
end loop
end chkForLvl1Block
% Checking for blocks / coin blocks on the second level
procedure chkForLvl2Block
loop
curItemPosition := curItemPosition + 1
if ypos > 239 then
if mapPartsArray (curItemPosition, 4) = "1" or mapPartsArray (curItemPosition, 5) = "1" then
if (curItemPosition * 30 - xpos) > blockCol1 then
if (curItemPosition * 30 - xpos) < blockCol2 then
groundHeight := 240
exit when 1 = 1
else
groundHeight := 60
end if
end if
end if
end if
if ypos = 170 then
if mapPartsArray (curItemPosition, 4) = "1" or mapPartsArray (curItemPosition, 5) = "1" then
if (curItemPosition * 30 - xpos) > blockCol1 then
if (curItemPosition * 30 - xpos) < blockCol2 then
yvel := -2
exit when 1 = 1
else
end if
end if
end if
end if
if curItemPosition = mapLength then
exit when 1 = 1
end if
end loop
end chkForLvl2Block
% Checking for and moving enemy sprites.
procedure enemyCheck
end enemyCheck
% Enemy position on the x axis
procedure enemyPhysics
curItemPosition := 1
loop
goombaPosY (curItemPosition) := goombaPosY (curItemPosition) + goombaVelY (curItemPosition)
if goombaPosY (curItemPosition) not= 60 then
goombaVelY (curItemPosition) := goombaVelY (curItemPosition) - Gravity
end if
curItemPosition := curItemPosition + 1
exit when curItemPosition = mapLength
end loop
end enemyPhysics