5521
TI Z80 / Re: Side Project #2: DUNGEON
« on: May 09, 2009, 03:53:22 pm »
because I need to be able to revert back a few times, read this:
Code: [Select]
:For(A,2,9) ;
:Text(‾1,8A-2(8),0,sub(Str1,15A-(14+15),15 ;this is my
:StorePic 2 ;dual text
:Text(‾1,8A-2(8),0,sub(Str2,15A-(14+15),15 ;sprite engine
:RecallPic 2 ;
:End
:L1(4→B:L1(5→A ;store initial starting point
:DelVar J ;delete jump variable
:Text(‾1,8,90,L1(2 ;display health
:While A≠1 and A≠10 and B≠1 and B≠15 and L1(2 ;check to make sure that you have health and are not on edge of map
:A→C ;store Y
:B→D ;store x
:Text(‾1,8A-8,6B-6,"Ω ;display character
:If L1(3 ;if you are on a spike
:Then
:2→L1(3
:Text(‾1,8A-8,6B-6,"* ;replace spike sprite
:End
:DelVar K ;I have no idea why I put it here...I'll get rid of it
:getKey→K ;store key press
:If K:Then ;if keypress
:B+(K=26)-(K=24→B ;movement
:If B≠D ;tests to see if you moved
:Then
:If ""=sub(Str1,15A-14+B-1,1 ;tests to make sure you are moving onto a blank spot
:D→B ;if not, revert x
:End
:End
:If ""≠sub(Str1,15(A+1)-14+B-1,1 ;if you are not above a tile
:Then
:A+1→A ;gravity happens
:If J:A-1→A ;unless you are jumping
:Else
:J+L1(1)(K=21→J
:End
:If J:Then ;if you are jumping
:If ""≠sub(Str1,15(A-1)-14+B-1,1 ;test to make sure there is a blank above you
:Then
:A-1→A ;if not, you stay still
:End
:J-1→J ;minus one to jump time
:End
:If A≠C or B≠D ;if you have moved
:Then
:Text(‾1,8A-8,6B-6,"Ω ;move character
:Text(‾1,8C-8,6D-6," ;clear last spot you were on
:If 2=L1(3 ;if you were on a spike
:Then
:Text(‾1,8C-8,6D-6,"* ;reset spike sprite
:0→L1(3 ;clear spike flag
:End
:End
:If Instring("Δ*~",sub(Str1,15A-14+B-1,1 ;If you are on something that does something to you
:then
:If "Δ"=sub(Str1,15A-14+B-1,1 ;if on a health pack
:Then
:L1(2)+3→L1(2 ;add health!
:If 9<L1(2 ;but keep it below 10
:9→L1(2
:sub(Str1,15A-14+B,length(Str1)-15A-14+B→Str3 ;get rid of health from map
:sub(Str1,1,15A-14+B-2→Str1 ;still get rid of it
:Str1+" "+Str3→Str1 ;piece together map
:Text(‾1,8,90,L1(2
:Pause "HEALTH +3 ;tell the player what happened
:End
:If "~"=sub(Str1,15A-14+B-1,1 ;this is actually a small 0, but there is no equvalent on computers
:Then
:Pause "JUMP BOOST ;tell them that they are one step closer to flying
:sub(Str1,15A-14+B,length(Str1)-15A-14+B→Str3 ;delete boost
:sub(Str1,1,15A-14+B-2→Str1 ;delete I say!
:Str1+" "+Str3→Str1 ;now replace
:L1(1)+1→L1(1 ;actually give them the upgrade
:End
:If "*"=sub(Str1,15A-14+B-1,1 ;if you are on a spike
:Then
:L1(2)-1→L1(2 ;lower health
:Text(‾1,8,90,L1(2 ;update health in corner
:1→L1(3 ;set spike flag
:End
:End
:If "..."=sub(Str1,15(C-1)-14+D-1,1 ;if on monkey bars
:Then
:If A>C ;and gravity is making you fall
:Then
:A-1→A ;don't!
:Text(‾1,8(A+1)-8,6B-6," ;clear the sprite that is falling
:End
:End
:End
:A→L1(4 ;store new y
:B→L1(5 ;store new x