Adjustable, working trampolines.
set display mode 800,600,32
hide mouse
setuparrays()
sync on
sync rate 0
do
cls rgb(255,255,255)
everything()
set cursor 0,0:ink 0,0
print player(6)
sync
loop
function everything()
controls()
grid()
drawbackground()
drawplayer()
enemy()
enemypoly()
jumpgraph()
shooting()
drawblocks()
tramp()
drawforeground()
enemyhit?()
scrolling()
endfunction
function drawplayer()
lhandx#=player(1)+(player(4)*(player(3)/4.5))-player(4)*20
skiphandpos:
lhandy#=player(2)+28+sin(player(3))*10
rhandx#=player(1)-(player(4)*(player(3)/4.5))+player(4)*20
rhandy#=player(2)+32+sin(player(3))*10
lkneex#=player(1)+(player(4)*(player(3)/15))-player(4)*5
rkneex#=player(1)-(player(4)*(player(3)/15))+player(4)*5
lfootx#=player(1)+(player(4)*(player(3)/5))-player(4)*20
lfootybounce#=sin(player(3))*(-5)
if player(5)>0 then lfootybounce#=0
rfootx#=player(1)-(player(4)*(player(3)/5))+player(4)*15
rfootybounce#=sin(player(3))*(-5)
if player(5)<0 then rfootybounce#=0
ink 0,0
circle player(1)-screen#(1),player(2),10
circle player(1)+player(4)-screen#(1),player(2)-1,1
circle player(1)+player(4)*6-screen#(1),player(2)-1,1
line player(1)-screen#(1),player(2)+10,player(1)-screen#(1),player(2)+35
circle lhandx#-screen#(1),lhandy#,3
circle rhandx#-screen#(1),rhandy#,3
line player(1)-screen#(1),player(2)+15,lhandx#-screen#(1),lhandy#
line player(1)-screen#(1),player(2)+15,rhandx#-screen#(1),rhandy#
line player(1)-screen#(1),player(2)+35,lkneex#-screen#(1),player(2)+45
line player(1)-screen#(1),player(2)+35,rkneex#-screen#(1),player(2)+45
line lkneex#-screen#(1),player(2)+45,lfootx#-screen#(1),player(2)+60
line rkneex#-screen#(1),player(2)+45,rfootx#-screen#(1),player(2)+60
if player(4)=1
box lfootx#-player(4)*2-screen#(1),player(2)+60+rfootybounce#,lfootx#+player(4)*7-screen#(1),player(2)+65+rfootybounce#
box rfootx#-player(4)*2-screen#(1),player(2)+60+lfootybounce#,rfootx#+player(4)*7-screen#(1),player(2)+65+lfootybounce#
endif
if player(4)=-1
box lfootx#+player(4)*7-screen#(1),player(2)+60+lfootybounce#,lfootx#-player(4)*2-screen#(1),player(2)+65+lfootybounce#
box rfootx#+player(4)*7-screen#(1),player(2)+60+rfootybounce#,rfootx#-player(4)*2-screen#(1),player(2)+65+rfootybounce#
endif
endfunction
function controls()
player(1)=player(1)+player(8)
if leftkey()=1 and player(1)>10 and tramp#(6)=0
player(8)=-4
player(4)=-1
player(3)=player(3)-player(5)
endif
if rightkey()=1 and tramp#(6)=0
player(8)=4
player(4)=1
player(3)=player(3)+player(5)
endif
if leftkey()=0 and rightkey()=0 and tramp#(6)=0 then player(8)=0
if player(3)>180 or player(3)<0 then player(5)=player(5)*(-1)
if keystate(11)=1 and player(6)=0 and player(2)=floorheight(player(1),player(2)) then player(6)=25:player(7)=40
player(6)=player(6)-1
player(2)=player(2)-(player(6)/2)
if player(2)>floorheight(player(1),player(2)) and player(6)<0 then player(6)=0:player(2)=floorheight(player(1),player(2))
endfunction
function drawbackground()
ink rgb(150,185,150),0
line 0,480,800,480
center text 600-screen#(1),485,"y=2"
ink rgb(185,150,150),0
for x=0 to 100
line x*8,sin((x+screen#(1)/15)*8)*(-40)+220,(x+1)*8,sin((x+1+screen#(1)/15)*8)*(-40)+220
next x
center text 200-screen#(1)/1.85,200,"y=sin x"
ink rgb(190,200,100),0
circle 700-screen#(1)/3,50,80
center text 670-screen#(1)/3,50,"y^2 + x^2 = r^2"
endfunction
function grid()
ink rgb(240,240,240),0
for x = 1 to 9
line x*80,0,x*80,600
next x
for y = 1 to 7
line 0,y*80,800,y*80
next y
endfunction
function jumpgraph()
jgraph(player(6),1)=player(1)
jgraph(player(6),2)=player(2)
if player(6)=0 then for t= 1 to 100:jgraph(t,1)=0:jgraph(t,2)=0:next t
if player(7)<254 then player(7)=player(7)+7
for x = 1 to 100
if player(6)>0
ink rgb(player(7),player(7),player(7)),0
dot jgraph(x,1)-screen#(1),jgraph(x,2)+70
endif
next x
endfunction
function setuparrays()
dim player(8):dim jgraph(100,2)
player(2)=0
player(1)=400
player(5)=5
dim level(3,500,30)
dim screen#(2)
dim enemypos(2)
dim poly(9,2):poly(9,2)=5
dim bullets(8,4)
dim tramp#(6):tramp#(1)=1600:tramp#(2)=480:tramp#(3)=270-40
for t = 0 to 500
level(2,t,10)=2
next t
for t = 7 to 10
level(2,t,4)=1
next t
for t = 2 to 5
level(2,t,7)=1
next t
for t = 13 to 15
level(2,t,2)=1
next t
for t = 24 to 31
level(2,t,7)=1
next t
for t = 41 to 43
level(2,t,3)=1
next t
for t = 46 to 48
level(2,t,3)=1
next t
endfunction
function block(PosX,PosY)
ink 0,0
line PosX-20,PosY-20,PosX-20,PosY+20
line PosX-20,PosY+20,PosX+20,PosY+20
line PosX+20,PosY+20,PosX+20,PosY-20
line PosX+20,PosY-20,PosX-20,PosY-20
endfunction
function floorheight(PosX, PosY)
for y = PosY/40 to 30
if level(2,PosX/40,y)=1 or level(2,PosX/40,y)=2 then Height = y*40+15:goto skip
next y
skip:
endfunction Height
function drawblocks()
for x = 1 to 500
for y = 1 to 30
if level(2,x,y)=1 then block(x*40+20-screen#(1),y*40+100)
next y
next x
endfunction
function scrolling()
if player(1)>screen#(1)+500 then screen#(1)=screen#(1)+player(8)
if player(1)<screen#(1)+300 then screen#(1)=screen#(1)-player(8)
endfunction
function drawforeground()
ink rgb(200,220,200),0
for x = -10 to 10
line x*10+400-screen#(1)*1.5,(x*10)^2/25+200,(x+1)*10+400-screen#(1)*1.5,((x+1)*10)^2/25+200
line x*10+200-screen#(1)*1.5,(x*10)^2/25+300,(x+1)*10+200-screen#(1)*1.5,((x+1)*10)^2/25+300
line x*30+1500-screen#(1)*1.5,(x*30)^2/265+300,(x+1)*30+1500-screen#(1)*1.5,((x+1)*30)^2/265+300
next x
center text 350-screen#(1)*1.5,550,"y = x^2"
center text 1550-screen#(1)*1.5,330,"y = (x^2)/2"
endfunction
function enemy()
if enemypos(1)<player(1) then enemypos(1)=enemypos(1)+2
if enemypos(1)>player(1) then enemypos(1)=enemypos(1)-2
if poly(8,1)<player(1) and poly(9,2)>3 then poly(8,1)=poly(8,1)+3
if poly(8,1)>player(1) and poly(9,2)>3 then poly(8,1)=poly(8,1)-3
if enemypos(2)<floorheight(enemypos(1),enemypos(2)) then enemypos(2)=enemypos(2)+5
if poly(8,2)<floorheight(poly(8,1),poly(8,2)) then poly(8,2)=poly(8,2)+5
ink 0,0
box enemypos(1)-15-screen#(1),enemypos(2)-15+45,enemypos(1)+15-screen#(1),enemypos(2)+15+45
endfunction
function enemypoly()
for t = 0 to poly(9,2)-1
poly(t,1)=newxvalue(poly(8,1),t*(360/poly(9,2))+poly(9,1),20)
poly(t,2)=newzvalue(poly(8,2),t*(360/poly(9,2))+poly(9,1),20)
next t
if poly(9,2)>3 and ABS(poly(8,1)-player(1))<4 then goto skippolyturn
if poly(9,2)>3 and poly(8,1)>player(1) then poly(9,1)=poly(9,1)+2
if poly(9,2)>3 and poly(8,1)<player(1) then poly(9,1)=poly(9,1)-2
skippolyturn:
if poly(9,2)<3.5 then poly(9,1)=180
for t = 0 to poly(9,2)-1
ink rgb(150,150,150),0
if t=poly(9,2)-1 then line poly(t,1)-screen#(1),poly(t,2)+40,poly(t-(poly(9,2)-1),1)-screen#(1),poly(t-(poly(9,2)-1),2)+40:goto skippoly
line poly(t,1)-screen#(1),poly(t,2)+40,poly(t+1,1)-screen#(1),poly(t+1,2)+40
ink 0,0
circle poly(8,1)-screen#(1),poly(8,2)+40,1
next t
skippoly:
endfunction
function drawbullet(PosX, PosY, Typ)
if Typ=1
ink 0,0
box PosX-10-screen#(1),PosY-3,PosX+10-screen#(1),PosY+3
endif
if Typ=2
ink 0,0
box PosX-10-screen#(1),PosY-3,PosX+10-screen#(1),PosY+3
box PosX-3-screen#(1),PosY-10,PosX+3-screen#(1),PosY+10
endif
endfunction
function shooting()
bullets(8,1)=bullets(8,1)-1
if keystate(12)=1 and bullets(8,1)<0
for t = 0 to 7 step 2
if bullets(t,1)=0
bullets(t,1)=player(1)
bullets(t,2)=player(2)+25
bullets(t,3)=player(4)
bullets(8,1)=30
bullets(t,4)=1
goto skipshoot
endif
next t
skipshoot:
endif
if keystate(13)=1 and bullets(8,1)<0
for t = 1 to 7 step 2
if bullets(t,1)=0
bullets(t,1)=player(1)
bullets(t,2)=player(2)+25
bullets(t,3)=player(4)
bullets(8,1)=30
bullets(t,4)=2
goto skipshoot2
endif
next t
skipshoot2:
endif
for t = 0 to 7
if bullets(t,1)>0 then bullets(t,1)=bullets(t,1)+bullets(t,3)*8:drawbullet(bullets(t,1),bullets(t,2),bullets(t,4))
if bullets(t,1)>player(1)+500 then bullets(t,1)=0
if bullets(t,1)<player(1)-500 then bullets(t,1)=0
next t
endfunction
function enemyhit?()
for b = 0 to 7
if ABS(enemypos(1)-bullets(b,1))<60 and ABS((enemypos(2)+45)-bullets(b,2))<60 then enemypos(2)=900:bullets(b,1)=0
if ABS(poly(8,1)-bullets(b,1))<60 and ABS((poly(8,2)+45)-bullets(b,2))<60 and poly(8,2)>10
poly(9,2)=poly(9,2)-1
bullets(b,1)=0
if poly(9,2)<3 then poly(9,2)=8:poly(8,2)=-10
endif
next b
endfunction
function tramp()
ink 0,0
line tramp#(1)-screen#(1),tramp#(2),newxvalue(tramp#(1),(tramp#(3)+tramp#(5)),80)-screen#(1),newzvalue(tramp#(2),(tramp#(3)+tramp#(5)),80)
line tramp#(1)-screen#(1),tramp#(2),tramp#(1)-80-screen#(1),tramp#(2)
for t = 0 to 5
startx#=newxvalue(tramp#(1),90+(270-(tramp#(3)+tramp#(5)))/6*t,70)
startx#=tramp#(1)+(tramp#(1)-startx#)
starty#=newzvalue(tramp#(2),90+(270-(tramp#(3)+tramp#(5)))/6*t,70)
endx#=newxvalue(tramp#(1),90+(270-(tramp#(3)+tramp#(5)))/6*(t+1),70)
endx#=tramp#(1)+(tramp#(1)-endx#)
endy#=newzvalue(tramp#(2),90+(270-(tramp#(3)+tramp#(5)))/6*(t+1),70)
ink rgb(180,180,180),0
line startx#-screen#(1),starty#,endx#-screen#(1),endy#
center text tramp#(1)-80-screen#(1),tramp#(2)-10,"arc"
next t
if ABS(player(1)-(tramp#(1)-20))<40 and ABS(player(2)-(tramp#(2)-40))<40 and player(6)<0 then tramp#(4)=1:player(6)=35:player(7)=0:player(8)=(270-tramp#(3))/4:tramp#(6)=1
if tramp#(6)=1 and player(2)=floorheight(player(1),player(2)) then tramp#(6)=0
if tramp#(4)>0 then tramp#(4)=tramp#(4)+8
if tramp#(4)>180 then tramp#(4)=0
tramp#(5)=sin(tramp#(4))*10
for b = 0 to 7
if b=0 or b=2 or b=4 or b=6
if ABS(tramp#(1)-bullets(b,1))<60 and ABS(tramp#(2)-bullets(b,2))<60 and bullets(b,1)>10 and 270-tramp#(3)>10
tramp#(3)=tramp#(3)+10:bullets(b,1)=0
endif
endif
if b=1 or b=3 or b=5 or b=7
if ABS(tramp#(1)-bullets(b,1))<60 and ABS(tramp#(2)-bullets(b,2))<60 and bullets(b,1)>10 and 270-tramp#(3)<50
tramp#(3)=tramp#(3)-10:bullets(b,1)=0
endif
endif
next b
endfunction
A Screenshot: