TheMole Posted August 16, 2016 Share Posted August 16, 2016 (edited) Edit: I'm unable to find Size(), only SIZE which reports remaining ram? Still looking... It's an optional part of the DISPLAY command (like AT). "DISPLAY AT(23,1) SIZE(4):Score" will blank 4 characters, and then display the variable Score in that area. Edited August 16, 2016 by TheMole 1 Quote Link to comment Share on other sites More sharing options...
+Lee Stewart Posted August 16, 2016 Share Posted August 16, 2016 Edit: I'm unable to find Size(), only SIZE which reports remaining ram? Still looking... Sorry. I was far too cryptic. I should have pointed out what @TheMole said. ...lee 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 16, 2016 Author Share Posted August 16, 2016 All good! Thanks again! Quote Link to comment Share on other sites More sharing options...
Opry99er Posted August 16, 2016 Share Posted August 16, 2016 (edited) Use this 100 CALL CLEAR 120 CALL HCHAR(1,1,42,768) 150 DISPLAY AT(5,3):"ERASE LINE" 160 DISPLAY AT(7,3):"DON'T ERASE"; 170 GOTO 170 This should help. The simple semicolon after your DISPLAY AT will fix your ills. Edited August 16, 2016 by Opry99er 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 16, 2016 Author Share Posted August 16, 2016 Use this 100 CALL CLEAR 120 CALL HCHAR(1,1,42,768) 150 DISPLAY AT(5,3):"ERASE LINE" 160 DISPLAY AT(7,3):"DON'T ERASE"; 170 GOTO 170 This should help. The simple semicolon after your DISPLAY AT will fix your ills. Oh, the problem was resolved before making the post. I just put the display at before the calls. However; all of this new (to me) info is going to help a lot. Thanks for that tip also. Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 16, 2016 Author Share Posted August 16, 2016 (edited) OK, this is a minor update from the last - new death screen. When at this screen, press any key, move joystick or push joystick button to play again. 100 SCORE=0000 :: HEALTH=1 :: BOARD=1 110 MELEE=0 :: RANGED=0 !weapons inventory 120 CALL SCREEN(2) 130 CALL COLOR(10,15,1):: CALL COLOR(12,12,1):: CALL COLOR(3,12,1):: CALL COLOR(4,12,1) 140 CALL COLOR(8,7,1):: CALL COLOR(11,8,1) 150 CALL CLEAR 160 !running patterns right 170 DATA 1818101010101018,1818183C1C142630,181A3C5E1A334060,18197E981C724100,18197E9818147243,1818385E581C2436 180 !stop and jump right 190 DATA 1818101010101018,000C1C3058081018,00000C1C305C1C18,0000060E183C0C18,0003070C18081018 200 !jumping right 210 DATA 0303040609081010,1818141810106000,1818103810180C00,1818503010180404 220 !landing right 230 DATA 0018183050180818,1818101038501018 240 !running patterns left 250 DATA 1818080808080818,1818183C3828640C,18583C7A58CC0206,18987E19384E8200,18987E1918284EC2,18181C7A1A38246C 260 !stop and jump left 270 DATA 1818080808080818,0030380C1A100818,000030380C3A3818,00006070183C3018,00C0E03018100818 280 !jumping left 290 DATA C0C0206090100808,1818281808080600,1818081C08183000,18180A0C08182020 300 !landing right 310 DATA 0018180C0A181018,181808081C0A0818 320 FOR CHRR=33 TO 38 !setup for creating running characters right 330 READ PAT$ 340 CALL CHAR(CHRR,PAT$) 350 NEXT CHRR 360 REM CHR=CHRR 370 FOR CHSR=39 TO 43 !setup for creating stop and jump characters right 380 READ PAT$ 390 CALL CHAR(CHSR,PAT$) 400 NEXT CHSR 410 FOR CHJR=64 TO 67 !setup for creating jumping characters right 420 READ PAT$ 430 CALL CHAR(CHJR,PAT$) 440 NEXT CHJR 450 FOR CHLR=68 TO 69 !setup for creating landing characters right 460 READ PAT$ 470 CALL CHAR(CHLR,PAT$) 480 NEXT CHLR 490 REM left running*********************** 500 FOR CHRL=70 TO 75 !setup for creating running characters left 510 READ PAT$ 520 CALL CHAR(CHRL,PAT$) 530 NEXT CHRL 540 FOR CHSL=76 TO 80 !setup for creating stop and jump characters left 550 READ PAT$ 560 CALL CHAR(CHSL,PAT$) 570 NEXT CHSL 580 FOR CHJL=81 TO 84 !setup for creating jumping characters left 590 READ PAT$ 600 CALL CHAR(CHJL,PAT$) 610 NEXT CHJL 620 FOR CHLL=85 TO 86 !setup for creating landing characters left 630 READ PAT$ 640 CALL CHAR(CHLL,PAT$) 650 NEXT CHLL 660 BGIR$="3C4426D999A5C3FF" !BAD girder for level HOLE creation 670 GIR$="FFC3A59999A5C3FF" !GIRDER FOR LEVELS 680 CALL CHAR(104,BGIR$,105,GIR$)!girder for level creation 690 GRAV$="FFFFFFFFFFFFFFFF" :: CALL CHAR(106,GRAV$)!THE HOLE 700 EXT$="1F1111111D11111F" :: CALL CHAR(107,EXT$)!THE EXIT 710 HRT$="66FFFFFF7E7E3C18" :: CALL CHAR(88,HRT$)!THE HEART 720 ZED$="3C2418FF9918183C" :: CALL CHAR(96,ZED$)!THE ZED 730 MLE$="C0E0703A1E0C1A01" :: CALL CHAR(112,MLE$)!MELEE 740 RNG$="000000FF7F1E1606" :: CALL CHAR(113,RNG$)!RANGED WEAPONS 750 SCTXT1$="70808063141414E3" :: SCTXT2$="00000000334A4A32" :: SCTXT3$="00000000993C2118" !Word Score 760 CALL CHAR(120,SCTXT1$):: CALL CHAR(121,SCTXT2$):: CALL CHAR(122,SCTXT3$) 770 EXTXT$="0044442810284444" :: CALL CHAR(123,EXTXT$)! the letter X remain for GUI 780 LVLTXT$="E0E080E9EF86EFE9" :: CALL CHAR(124,LVLTXT$)! EX TEXT IN GUI 790 IDLE$="3838107CBA38286C" :: CALL CHAR(44,IDLE$)!***IDLE MAN 800 RANDOMIZE 810 SLOT=11 !STARTING SPRITE NUMBER FOR LOOT 820 OPTION BASE 1 830 DIM LO0T(2,14) 840 LTN=1 !LOOT ARRAY COORDS COL 850 LAB=1 !LOOT ARRAY COORDS ROW 860 SHL=2 :: GRND=17 !START ground level on top girder (YP+8pixels), LEVEL AND SPRITE HOLE # 870 LVL=3 :: YP=9 :: XP=8 :: RS=0 :: CS=16 :: RSPD=2 !start position direction and velocity 880 GOSUB 2140 !*******************************Create Level 890 REM***************************************Create Sprite Idle******** 900 CALL SPRITE(#1,44,6,YP,XP) 910 CALL JOYST(1,JX,JY):: CALL KEY(1,B,S)!check for joystick input (key is for fire button) 920 IF JY=0 THEN 930 ELSE 2680 930 CALL COINC(ALL,C):: IF C=0 THEN 950 ELSE 940 !collision check 940 GOSUB 2360 !collision actions 950 GOSUB 2990 !*************WALL COLLISION CHECK 960 IF S=0 THEN 1630 !no kb pressed check for joyst 970 REM ********jump routine check******** 980 CALL MOTION(#1,0,0) 990 IF CS<>-16 THEN 1030 1000 CALL POSITION(#1,YP,XP)!get new position for next sprite 1010 GOSUB 1070 ! goto jump left 1020 GOTO 890 1030 IF CS<>16 THEN 1630 1040 CALL POSITION(#1,YP,XP)!get new position for next sprite 1050 GOSUB 1350 !goto jump right************************** 1060 GOTO 890 1070 REM *************jump left routine********* 1080 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! 1090 CALL SPRITE(#1,CHSL,6,YP,XP)!recreate sprite1 as stop and jump characters 1100 FOR PT=76 TO 80 !setup stop and jump animation left 1110 CALL PATTERN(#1,PT)!ANIMATE 1120 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1130 NEXT DELAY 1140 NEXT PT !continue animating the stop and jump until done 1150 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping 1160 IF XP<=24 THEN 1260 1170 CS=-20 :: YP=YP-3 :: RS=0 :: CALL SPRITE(#1,CHJL,6,YP,XP,RS,CS)!jumping left 1180 FOR PT=81 TO 84 1190 CALL PATTERN(#1,PT) 1200 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1210 NEXT DELAY 1220 NEXT PT 1230 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 1240 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 1250 YP=YP+3 !RESET YP TO BE GROUND. 1260 CALL SPRITE(#1,CHLL,6,YP,XP) 1270 FOR PT=85 TO 86 !setup landing animation left 1280 CALL PATTERN(#1,PT) 1290 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1300 NEXT DELAY 1310 NEXT PT ! continue landing animation until last frame 1320 CALL POSITION(#1,YP,XP)!get new position for next sprite 1330 CS=-16 1340 RETURN 1350 REM *************jump right routine****** 1360 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! right 1370 CALL SPRITE(#1,CHSR,6,YP,XP)!recreate sprite1 as stop and jump characters right 1380 FOR PT=39 TO 43 !setup stop and jump animation right 1390 CALL PATTERN(#1,PT) 1400 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1410 NEXT DELAY 1420 NEXT PT !continue animating the stop and jump until done right 1430 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping right 1440 IF XP>=224 THEN 1540 1450 CS=20 :: YP=YP-3 :: CALL SPRITE(#1,CHJR,6,YP,XP,RS,CS)!jumping right 1460 FOR PT=64 TO 67 !setup jumping characters right 1470 CALL PATTERN(#1,PT) 1480 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1490 NEXT DELAY 1500 NEXT PT 1510 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 1520 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 1530 YP=YP+3 1540 CALL SPRITE(#1,CHLR,6,YP,XP) 1550 FOR PT=68 TO 69 !setup landing animation 1560 CALL PATTERN(#1,PT) 1570 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1580 NEXT DELAY 1590 NEXT PT ! continue landing animation until last frame 1600 CALL POSITION(#1,YP,XP)!get new position for next sprite 1610 CS=16 1620 RETURN 1630 REM **************Check Joyst Options************ 1640 IF JX<>0 THEN 1670 1650 CALL MOTION(#1,0,0) 1660 GOTO 910 1670 REM ********running check*************** 1680 IF JX<>-4 THEN 1710 1690 CALL POSITION(#1,YP,XP)!get new position for next sprite 1700 GOSUB 1940 1710 IF JX<>4 THEN 910 1720 CALL POSITION(#1,YP,XP)!get new position for next sprite 1730 GOSUB 1750 1740 GOTO 910 !after RETURN goto joyst check 1750 REM ************run right routine******** 1760 CS=16 :: CALL SPRITE(#1,CHRR,6,YP,XP)!create the runner and send running 1770 CALL MOTION(#1,0,JX*RSPD) 1780 FOR PT=33 TO 38 !setup for animating the run right 1790 CALL PATTERN(#1,PT) 1800 CALL JOYST(1,JX,JY):: CALL KEY(1,B,S)!check for joystick input (key is for fire button) 1810 CALL COINC(ALL,C):: IF C=0 THEN 1830 ELSE 1820 !collision check 1820 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 2360 !collision actions 1830 GOSUB 2990 !*************WALL COLLISION CHECK 1840 IF JY=0 THEN 1850 ELSE 2680 1850 IF JX<>0 THEN 1870 ELSE 1860 !not joy pressed keep running 1860 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 1870 IF JX=4 THEN 1890 1880 IF JX=-4 THEN 1930 1890 CALL MOTION(#1,0,JX*RSPD) 1900 NEXT PT 1910 IF JX=4 THEN 1780 1920 CALL POSITION(#1,YP,XP)!check position and store before stopping motion 1930 RETURN 1940 REM **********run left routine************** 1950 CS=-16 :: CALL SPRITE(#1,CHRL,6,YP,XP)!create the runner and send running 1960 CALL MOTION(#1,0,JX*RSPD) 1970 FOR PT=70 TO 75 !setup for animating the run left 1980 CALL PATTERN(#1,PT) 1990 CALL JOYST(1,JX,JY):: CALL KEY(1,B,S)!check for joystick input (key is for fire button) 2000 CALL COINC(ALL,C):: IF C=0 THEN 2020 ELSE 2010 !collision check 2010 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 2360 !collision actions 2020 GOSUB 2990 !*************WALL COLLISION CHECK 2030 IF JY=0 THEN 2040 ELSE 2680 2040 IF JX<>0 THEN 2060 ELSE 2050 !not joy pressed keep running 2050 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 2060 CALL JOYST(1,JX,JY) 2070 IF JX=-4 THEN 2090 2080 IF JX=4 THEN 2130 2090 CALL MOTION(#1,0,JX*RSPD) 2100 NEXT PT 2110 IF JX=-4 THEN 1970 2120 CALL POSITION(#1,YP,XP)!check position and store for next sprite 2130 RETURN 2140 REM *************************************************************************level creation************************ 2150 GOSUB 3080 !*************************gui creation****** 2160 HLE=INT((RND*15)+5) 2170 FOR LVL=1 TO 8 2180 IF LVL=1 THEN 2200 2190 GOSUB 2720 !*************************************GOSUB********LOOT********** 2200 CALL VCHAR(1,1,105,24)!LEFT WALL 2210 CALL VCHAR(1,32,105,24)!RIGHT WALL 2220 CALL HCHAR(LVL*3,1,105,HLE-1)!LEFT SIDE GIRDERS 2230 CALL SPRITE(#SHL,106,1,GRND-3,(HLE*+1)!HOLE PROPER 2240 CALL HCHAR(LVL*3,HLE+3,105,32-(HLE+3))!RIGHT SIDE Girders 2250 CALL HCHAR(LVL*3,HLE,104)!CRUMBLE LEFT SIDE 2260 CALL HCHAR(LVL*3,HLE+2,104)!crumble right side 2270 GRND=GRND+24 2280 HOL=INT((RND*15)+5)!NEW LOCATION FOR HOLE 2290 IF HOL=HLE THEN 2280 !NOT EQUAL TO PREVIOUS HOLE 2300 HLE=HOL !SET PROPER HOLE VARIABLE 2310 SHL=SHL+1 !ADVANCE SPRITE # 2320 NEXT LVL !GO CREATE NEXT LEVEL 2330 CALL SPRITE(#10,107,15,22*8,30*! THE EXIT 2340 CALL HCHAR(24,1,105,31)!THE FLOOR 2350 RETURN 2360 REM *****************************************************************************************collision action******* 2370 CALL COINC(#1,#10,4,C):: IF C<>0 THEN 2680 ELSE 2380 !*********collision check against exit 2380 FOR DET=2 TO 8 2390 CALL COINC(#1,#DET,6,C)!*************************************collision check against holes 2400 IF C<>0 THEN 2660 ELSE 2410 2410 NEXT DET 2420 FOR DET=10 TO SLOT !************************collision check against LOOT********************* 2430 CALL COINC(#1,#DET,6,C) 2440 IF C<>0 THEN 2450 ELSE 2640 2450 FOR TLOOP1=1 TO 14 2460 IF LO0T(2,TLOOP1)<>DET THEN 2470 ELSE 2480 2470 NEXT TLOOP1 2480 IF LO0T(1,TLOOP1)<>88 THEN 2520 !heart 2490 SCORE=SCORE+100 :: IF HEALTH<10 THEN HEALTH=HEALTH+1 2500 GOSUB 3080 !*************************gui UPDATE****** 2510 GOTO 2630 2520 IF LO0T(1,TLOOP1)<>96 THEN 2560 !zed 2530 SCORE=SCORE+75 :: HEALTH=HEALTH-1 :: IF HEALTH<=0 THEN 3140 2540 GOSUB 3080 !*************************gui UPDATE****** 2550 GOTO 2630 2560 IF LO0T(1,TLOOP1)<>112 THEN 2600 !melee 2570 SCORE=SCORE+25 :: MELEE=MELEE+1 2580 GOSUB 3080 !*************************gui UPDATE****** 2590 GOTO 2630 2600 IF LO0T(1,TLOOP1)<>113 THEN 2630 !ranged 2610 SCORE=SCORE+50 :: RANGED=RANGED+1 2620 GOSUB 3080 !*************************gui UPDATE****** 2630 CALL DELSPRITE(#DET):: GOTO 2670 !TEMP CODE - NEED TO GET PATTERNS TO IDENTIFY LOOT BEFORE BEHAVIOUR 2640 NEXT DET 2650 GOTO 2670 2660 FOR FALL=1 TO 24 :: YP=YP+1 :: CALL SPRITE(#1,44,6,YP,XP):: NEXT FALL !*****FALL********** 2670 RETURN 2680 REM *****************************************************BOARD**Progression************ 2690 CALL DELSPRITE(ALL):: BOARD=BOARD+1 2700 RESTORE 170 2710 IF JY<>0 THEN 100 ELSE GOTO 120 2720 REM ***********************************************************LOOT DISTRIBUTION SYSTEM****** 2730 SWITCH=INT(RND*2)+1 2740 FOR LT=1 TO 2 2750 LOOT=INT(RND*4)+1 2760 IF SWITCH=1 THEN 2770 ELSE 2780 2770 SWITCH=-5 :: GOTO 2810 2780 IF SWITCH=2 THEN 2790 ELSE 2800 2790 SWITCH=5 :: GOTO 2780 2800 IF SWITCH=5 THEN SWITCH=-5 ELSE SWITCH=5 2810 IF LOOT<>1 THEN 2850 2820 CALL SPRITE(#SLOT,88,7,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !HEART LOOT 2830 LO0T(LAB,LTN)=88 :: LAB=LAB+1 2840 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 2850 IF LOOT<>2 THEN 2890 2860 CALL SPRITE(#SLOT,96,4,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !ZED 2870 LO0T(LAB,LTN)=96 :: LAB=LAB+1 2880 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 2890 IF LOOT<>3 THEN 2930 2900 CALL SPRITE(#SLOT,112,8,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !MELEE 2910 LO0T(LAB,LTN)=112 :: LAB=LAB+1 2920 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 2930 IF LOOT<>4 THEN 2970 2940 CALL SPRITE(#SLOT,113,14,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !RANGED 2950 LO0T(LAB,LTN)=113 :: LAB=LAB+1 2960 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 2970 NEXT LT 2980 RETURN 2990 REM **********cOLLISION cHECK WALLs 3000 CALL POSITION(#1,YP,XP):: IF XP<=100 THEN 3010 ELSE 3040 3010 CALL COINC(#1,YP,4,8,C):: IF C<>0 THEN 3020 ELSE 3070 3020 CALL LOCATE(#1,YP,13):: CALL MOTION(#1,0,0) 3030 CALL JOYST(1,JX,JY):: IF JX=-4 THEN 3020 ELSE RETURN 3040 CALL COINC(#1,YP,247,8,C):: IF C<>0 THEN 3050 ELSE 3070 3050 CALL LOCATE(#1,YP,239):: CALL MOTION(#1,0,0) 3060 CALL JOYST(1,JX,JY):: IF JX=4 THEN 3050 ELSE RETURN 3070 RETURN 3080 REM ********************GUI*********** 3090 DISPLAY AT(1,4):SCORE :: DISPLAY AT(1,11):BOARD :: DISPLAY AT(1,16):HEALTH :: DISPLAY AT(1,22):MELEE :: DISPLAY AT(1,27):RANGED !Output GUI 3100 CALL VCHAR(1,4,120):: CALL VCHAR(1,5,121):: CALL VCHAR(1,6,122)!score text gui 3110 CALL VCHAR(1,13,123):: CALL VCHAR(1,18,123):: CALL VCHAR(1,24,123):: CALL VCHAR(1,29,123)!Xs gui 3120 CALL VCHAR(1,12,124):: CALL VCHAR(1,17,88):: CALL VCHAR(1,23,112):: CALL VCHAR(1,28,113)!BOARD,hearts,melee,ranged gui 3130 RETURN 3140 REM ******************************YOU ARE DEAD*********************** 3150 CALL MOTION(#1,0,0):: CALL DELSPRITE(ALL):: CALL SCREEN(10) 3160 DATA 89,0044442810101010,79,007C44444444447C,85,0044444444444438 3161 data 65,003844447C444444,82,0078444478504844,69,007C40407840407C 3162 data 68,0078242424242478 3163 for yad=1 to 7 3164 read yadc,yadp$ 3165 call char(yadc,yadp$) 3166 next yad 3167 call clear 3168 call vchar(12,10,89)::call vchar(12,11,79)::call vchar(12,12,85)::call vchar(12,13,32)!YOU 3169 call vchar(12,14,65)::call vchar(12,15,82)::call vchar(12,16,69)::call vchar(12,17,32)!ARE 3170 call vchar(12,18,68)::call vchar(12,19,69)::call vchar(12,20,65)::call vchar(12,21,68)!DEAD 3171 for clrs=1 to 13::CALL COLOR(clrs,16,1)::next clrs 3190 call screen(2)::CALL KEY(1,K,S):: IF S<>0 THEN 3210 3210 GOSUB 3080 3220 CALL KEY(1,K,S) 3221 call joyst(1,jx,jy)::If JX<>0 then 3240::if jy<>0 then 3240 3230 IF S=0 THEN 3220 3240 JY=4 3250 GOTO 2680 Edited August 18, 2016 by Sinphaltimus Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 17, 2016 Share Posted August 17, 2016 130 CALL COLOR(10,15,1):: CALL COLOR(12,12,1):: CALL COLOR(3,12,1):: CALL COLOR(4,12,1) 140 CALL COLOR(8,7,1):: CALL COLOR(11,8,1) can be rewritten as 130 CALL COLOR(3,12,1,4,12,1,8,7,1,10,15,1,11,8,1,12,12,1) Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 17, 2016 Author Share Posted August 17, 2016 (edited) Yeah, I'm not optimising any code until I'm done with the core mechanics. I like to keep as many lines as separated as much as I can until done. For me it makes it easier to trouble shoot. I'll end up shortening a lot and combining lines just before stripping out all the comments to reduce the size. Thank you though. Edited August 18, 2016 by Sinphaltimus 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 18, 2016 Author Share Posted August 18, 2016 (edited) Whether or not you've been following this thread :http://atariage.com/forums/topic/254360-graphics-on-your-ti-are-you-interested/I hope you'll enjoy this.I started doing animation and graphics stuff on that other thread. Then I started using joystick controls etc.. I made a little pixel man that runs and jump.Then I added a random hole he could fall in to or jump over.Then I got an idea for a game so I'm going to make it. It's called ZOMBi. Something that says Zombie game for the ti? Maybe I'll change it, been on the fence with ZOMBi99er.Anyway, I'll use this thread to share the code and progress.I will update this code below to the latest version when ever announced in a new comment so you don't have to go searching.Just copy/paste from below OR download the class99 save dsk1.ZOMBI027 file that is attached >>here<<. Version 027 changes (*8/18/16) - X=Quit, R=Reset, J and Controller Button = Jump, Joystick Left/Right moves left/right, Joystick up = melee attack temporarily using just a high pitched sound for place holder. Joystick down = ranged attack temporarily using a noise for place holder. Adjusted running animations slightly. Set up weapon inventory. Entered new CHAR patterns and codes for ZEDS and combat. Setup empty framework for zed coinc and combat. To Do Next:Create attacks for melee and ranged including inventory changes Create basic zombie AI and animate. KNOW ISSUES:*FIXED - Q,R,J,q,r,j keys not working. Joy up not working. They were, and might in this version but I made a minor change that shouldn't have effected any of this, tested and discovered they are all broken. I think I lost the newest version someplace. Anyway, BUG FIXING! To Do Long Term: Title screen. Sounds Music maybe? - can I play music while player plays game efficiently? Loot balancing with board progression. zombie difficulty linked to board progression. At least 2 more types of ever more difficult zombies. Change Log: version 0.26-081516 Level Progression Working with new GUI element. *Pushing Joystick up or down RESETS the game. Board progression works via the EXIT. Zombies do -1 heart/health damage. 0 health = death. Hearts = +1 health, 10 max. FIXED*Sometimes holes don't spawn where holes are supposed to spawn causing a "no exit" situation. I dunno why yet.FIXED*Sometimes loot doesn't spawn where it is supposed to. I dunno why yet. FIXED*Sometimes the player falls through the girders near or very far from the hole. I dunno why yet. New death screen. When at this screen, press any key, move joystick to push joystick button to play again. 100 SCORE=0000 :: HEALTH=10 :: BOARD=1 110 MELEE=0 :: RANGED=0 !weapons inventory 120 CALL SCREEN(2) 130 CALL COLOR(10,15,1):: CALL COLOR(12,12,1):: CALL COLOR(3,12,1):: CALL COLOR(4,12,1) 140 CALL COLOR(8,7,1):: CALL COLOR(11,8,1) 150 CALL CLEAR 160 !running patterns right 170 DATA 1818101010101018,1818183C1C142630,181A3C5E1A334060,18197E981C724100,18197E9818147243,1818385E581C2436 180 !stop and jump right 190 DATA 1818101010101018,000C1C3058081018,00000C1C305C1C18,0000060E183C0C18,0003070C18081018 200 !jumping right 210 DATA 0303040609081010,1818141810106000,1818103810180C00,1818503010180404 220 !landing right 230 DATA 0018183050180818,1818101038501018 240 !running patterns left 250 DATA 1818080808080818,1818183C3828640C,18583C7A58CC0206,18987E19384E8200,18987E1918284EC2,18181C7A1A38246C 260 !stop and jump left 270 DATA 1818080808080818,0030380C1A100818,000030380C3A3818,00006070183C3018,00C0E03018100818 280 !jumping left 290 DATA C0C0206090100808,1818281808080600,1818081C08183000,18180A0C08182020 300 !landing right 310 DATA 0018180C0A181018,181808081C0A0818 320 FOR CHRR=33 TO 38 !setup for creating running characters right 330 READ PAT$ 340 CALL CHAR(CHRR,PAT$) 350 NEXT CHRR 360 REM CHR=CHRR 370 FOR CHSR=39 TO 43 !setup for creating stop and jump characters right 380 READ PAT$ 390 CALL CHAR(CHSR,PAT$) 400 NEXT CHSR 410 FOR CHJR=64 TO 67 !setup for creating jumping characters right 420 READ PAT$ 430 CALL CHAR(CHJR,PAT$) 440 NEXT CHJR 450 FOR CHLR=68 TO 69 !setup for creating landing characters right 460 READ PAT$ 470 CALL CHAR(CHLR,PAT$) 480 NEXT CHLR 490 REM left running*********************** 500 FOR CHRL=70 TO 75 !setup for creating running characters left 510 READ PAT$ 520 CALL CHAR(CHRL,PAT$) 530 NEXT CHRL 540 FOR CHSL=76 TO 80 !setup for creating stop and jump characters left 550 READ PAT$ 560 CALL CHAR(CHSL,PAT$) 570 NEXT CHSL 580 FOR CHJL=81 TO 84 !setup for creating jumping characters left 590 READ PAT$ 600 CALL CHAR(CHJL,PAT$) 610 NEXT CHJL 620 FOR CHLL=85 TO 86 !setup for creating landing characters left 630 READ PAT$ 640 CALL CHAR(CHLL,PAT$) 650 NEXT CHLL 660 BGIR$="3C4426D999A5C3FF" !BAD girder for level HOLE creation 670 GIR$="FFC3A59999A5C3FF" !GIRDER FOR LEVELS 680 CALL CHAR(104,BGIR$,105,GIR$)!girder for level creation 690 GRAV$="FFFFFFFFFFFFFFFF" :: CALL CHAR(106,GRAV$)!THE HOLE 700 EXT$="1F1111111D11111F" :: CALL CHAR(107,EXT$)!THE EXIT 710 HRT$="66FFFFFF7E7E3C18" :: CALL CHAR(88,HRT$)!THE HEART 720 ZED$="3C2418FF9918183C" :: CALL CHAR(96,ZED$)!THE ZED 730 MLE$="C0E0703A1E0C1A01" :: CALL CHAR(112,MLE$)!MELEE 740 RNG$="000000FF7F1E1606" :: CALL CHAR(113,RNG$)!RANGED WEAPONS 750 SCTXT1$="70808063141414E3" :: SCTXT2$="00000000334A4A32" :: SCTXT3$="00000000993C2118" !Word Score 760 CALL CHAR(120,SCTXT1$):: CALL CHAR(121,SCTXT2$):: CALL CHAR(122,SCTXT3$) 770 EXTXT$="0044442810284444" :: CALL CHAR(123,EXTXT$)! the letter X remain for GUI 780 LVLTXT$="E0E080E9EF86EFE9" :: CALL CHAR(124,LVLTXT$)! EX TEXT IN GUI 790 IDLE$="3838107CBA38286C" :: CALL CHAR(44,IDLE$)!***IDLE MAN 800 MMELE$="3C3C18FF7E3C183C" :: MRNGL$="0C0C04FC4C3C286C" :: MRNGR$="3030203F323C1436" ! MELEE & l/r RANGED ATTACKS 810 MWA$="002418FF1824" :: BULET$="0000008" !WEAPONS FIRE 820 ZDI$="3C2418FF9918183C" :: ZDA$="3CA5DB7E1818183C" :: ZWL1$="3C2C18F81838246C" :: ZWL2$="3C2C18F818181838" !ZED IDLE&WALK LEFT 830 ZWR1$="3C34181F181C2436" :: ZWR2$="3C34181F1818181C" !ZED WALK RIGHT 840 RANDOMIZE 850 SLOT=11 !STARTING SPRITE NUMBER FOR LOOT and more 860 OPTION BASE 1 870 DIM LO0T(2,14)!LOOT DISTRIBUTION AND COLLISION. 880 LTN=1 !LOOT ARRAY COORDS COL 890 LAB=1 !LOOT ARRAY COORDS ROW 900 SHL=2 :: GRND=17 !START ground level on top girder (YP+8pixels), LEVEL AND SPRITE HOLE # 910 LVL=3 :: YP=9 :: XP=8 :: RS=0 :: CS=16 :: RSPD=2 !start position direction and velocity 920 GOSUB 2270 !*******************************Create Level 930 REM***************************************Create Sprite Idle******** 940 CALL SPRITE(#1,44,6,YP,XP) 950 CALL JOYST(1,JX,JY):: !check for joystick input 960 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 3600 :: IF K=6 THEN 970 ELSE 980 970 CALL DELSPRITE(ALL):: RESTORE 170 :: GOTO 100 980 IF JY=0 THEN 1000 ELSE 990 990 GOSUB 3540 1000 CALL COINC(ALL,C):: IF C=0 THEN 1020 ELSE 1010 !collision check 1010 GOSUB 2490 !collision actions 1020 GOSUB 3100 !*************WALL COLLISION CHECK 1030 IF K<>18 AND K<>74 AND K<>106 THEN 1700 !no kb pressed check for joyst 1040 REM ********jump routine check******** 1050 CALL MOTION(#1,0,0) 1060 IF CS<>-16 THEN 1100 1070 CALL POSITION(#1,YP,XP)!get new position for next sprite 1080 GOSUB 1140 ! goto jump left 1090 GOTO 930 1100 IF CS<>16 THEN 1700 1110 CALL POSITION(#1,YP,XP)!get new position for next sprite 1120 GOSUB 1420 !goto jump right************************** 1130 GOTO 930 1140 REM *************jump left routine********* 1150 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! 1160 CALL SPRITE(#1,CHSL,6,YP,XP)!recreate sprite1 as stop and jump characters 1170 FOR PT=76 TO 80 !setup stop and jump animation left 1180 CALL PATTERN(#1,PT)!ANIMATE 1190 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1200 NEXT DELAY 1210 NEXT PT !continue animating the stop and jump until done 1220 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping 1230 IF XP<=24 THEN 1330 1240 CS=-20 :: YP=YP-3 :: RS=0 :: CALL SPRITE(#1,CHJL,6,YP,XP,RS,CS)!jumping left 1250 FOR PT=81 TO 84 1260 CALL PATTERN(#1,PT) 1270 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1280 NEXT DELAY 1290 NEXT PT 1300 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 1310 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 1320 YP=YP+3 !RESET YP TO BE GROUND. 1330 CALL SPRITE(#1,CHLL,6,YP,XP) 1340 FOR PT=85 TO 86 !setup landing animation left 1350 CALL PATTERN(#1,PT) 1360 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1370 NEXT DELAY 1380 NEXT PT ! continue landing animation until last frame 1390 CALL POSITION(#1,YP,XP)!get new position for next sprite 1400 CS=-16 1410 RETURN 1420 REM *************jump right routine****** 1430 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! right 1440 CALL SPRITE(#1,CHSR,6,YP,XP)!recreate sprite1 as stop and jump characters right 1450 FOR PT=39 TO 43 !setup stop and jump animation right 1460 CALL PATTERN(#1,PT) 1470 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1480 NEXT DELAY 1490 NEXT PT !continue animating the stop and jump until done right 1500 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping right 1510 IF XP>=224 THEN 1610 1520 CS=20 :: YP=YP-3 :: CALL SPRITE(#1,CHJR,6,YP,XP,RS,CS)!jumping right 1530 FOR PT=64 TO 67 !setup jumping characters right 1540 CALL PATTERN(#1,PT) 1550 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1560 NEXT DELAY 1570 NEXT PT 1580 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 1590 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 1600 YP=YP+3 1610 CALL SPRITE(#1,CHLR,6,YP,XP) 1620 FOR PT=68 TO 69 !setup landing animation 1630 CALL PATTERN(#1,PT) 1640 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 1650 NEXT DELAY 1660 NEXT PT ! continue landing animation until last frame 1670 CALL POSITION(#1,YP,XP)!get new position for next sprite 1680 CS=16 1690 RETURN 1700 REM **************Check Joyst Options************ 1710 IF JX<>0 THEN 1740 1720 CALL MOTION(#1,0,0) 1730 GOTO 950 1740 REM ********running check*************** 1750 IF JX<>-4 THEN 1780 1760 CALL POSITION(#1,YP,XP)!get new position for next sprite 1770 GOSUB 2040 1780 IF JX<>4 THEN 950 1790 CALL POSITION(#1,YP,XP)!get new position for next sprite 1800 GOSUB 1820 1810 GOTO 950 !after RETURN goto joyst check 1820 REM ************run right routine******** 1830 CS=16 :: CALL SPRITE(#1,CHRR,6,YP,XP)!create the runner and send running 1840 CALL MOTION(#1,0,JX*RSPD) 1850 FOR PT=33 TO 38 STEP 2 !setup for animating the run right 1860 CALL PATTERN(#1,PT) 1870 CALL JOYST(1,JX,JY):: !check for joystick input 1880 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 3600 :: IF K=6 THEN 1890 ELSE 1900 1890 CALL DELSPRITE(ALL):: RESTORE 170 :: GOTO 100 1900 CALL COINC(ALL,C):: IF C=0 THEN 1920 ELSE 1910 !collision check 1910 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 2490 !collision actions 1920 GOSUB 3100 !*************WALL COLLISION CHECK 1930 IF JY=0 THEN 1950 ELSE 1940 1940 GOSUB 3540 1950 IF JX<>0 THEN 1970 ELSE 1960 !not joy pressed keep running 1960 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 1970 IF JX=4 THEN 1990 1980 IF JX=-4 THEN 2030 1990 CALL MOTION(#1,0,JX*RSPD) 2000 NEXT PT 2010 IF JX=4 THEN 1850 2020 CALL POSITION(#1,YP,XP)!check position and store before stopping motion 2030 RETURN 2040 REM **********run left routine************** 2050 CS=-16 :: CALL SPRITE(#1,CHRL,6,YP,XP)!create the runner and send running 2060 CALL MOTION(#1,0,JX*RSPD) 2070 FOR PT=70 TO 75 STEP 2 !setup for animating the run left 2080 CALL PATTERN(#1,PT) 2090 CALL JOYST(1,JX,JY)!check for joystick input 2100 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 3600 :: IF K=6 THEN 2110 ELSE 2120 2110 CALL DELSPRITE(ALL):: RESTORE 170 :: GOTO 100 2120 CALL COINC(ALL,C):: IF C=0 THEN 2140 ELSE 2130 !collision check 2130 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 2490 !collision actions 2140 GOSUB 3100 !*************WALL COLLISION CHECK 2150 IF JY=0 THEN 2170 ELSE 2160 2160 GOSUB 3540 2170 IF JX<>0 THEN 2190 ELSE 2180 !not joy pressed keep running 2180 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 2190 CALL JOYST(1,JX,JY) 2200 IF JX=-4 THEN 2220 2210 IF JX=4 THEN 2260 2220 CALL MOTION(#1,0,JX*RSPD) 2230 NEXT PT 2240 IF JX=-4 THEN 2070 2250 CALL POSITION(#1,YP,XP)!check position and store for next sprite 2260 RETURN 2270 REM *************************************************************************level creation************************ 2280 GOSUB 3200 !*************************gui creation****** 2290 HLE=INT((RND*15)+5) 2300 FOR LVL=1 TO 8 2310 IF LVL=1 THEN 2330 2320 GOSUB 2830 !*************************************GOSUB********LOOT********** 2330 CALL VCHAR(1,1,105,24)!LEFT WALL 2340 CALL VCHAR(1,32,105,24)!RIGHT WALL 2350 CALL HCHAR(LVL*3,1,105,HLE-1)!LEFT SIDE GIRDERS 2360 CALL SPRITE(#SHL,106,1,GRND-3,(HLE* +1)!HOLE PROPER 2370 CALL HCHAR(LVL*3,HLE+3,105,32-(HLE+3))!RIGHT SIDE Girders 2380 CALL HCHAR(LVL*3,HLE,104)!CRUMBLE LEFT SIDE 2390 CALL HCHAR(LVL*3,HLE+2,104)!crumble right side 2400 GRND=GRND+24 2410 HOL=INT((RND*15)+5)!NEW LOCATION FOR HOLE 2420 IF HOL=HLE THEN 2410 !NOT EQUAL TO PREVIOUS HOLE 2430 HLE=HOL !SET PROPER HOLE VARIABLE 2440 SHL=SHL+1 !ADVANCE SPRITE # 2450 NEXT LVL !GO CREATE NEXT LEVEL 2460 CALL SPRITE(#10,107,15,22*8,30* ! THE EXIT 2470 CALL HCHAR(24,1,105,31)!THE FLOOR 2480 RETURN 2490 REM *****************************************************************collision action******* 2500 CALL COINC(#1,#10,4,C):: IF C<>0 THEN 2810 ELSE 2510 !*********collision check against exit 2510 FOR DET=2 TO 8 2520 CALL COINC(#1,#DET,6,C)!*************************************collision check against holes 2530 IF C<>0 THEN 2790 ELSE 2540 2540 NEXT DET 2550 FOR DET=10 TO SLOT !************************collision check against LOOT********************* 2560 CALL COINC(#1,#DET,6,C) 2570 IF C<>0 THEN 2580 ELSE 2770 2580 FOR TLOOP1=1 TO 14 2590 IF LO0T(2,TLOOP1)<>DET THEN 2600 ELSE 2610 2600 NEXT TLOOP1 2610 IF LO0T(1,TLOOP1)<>88 THEN 2650 !heart 2620 SCORE=SCORE+100 :: IF HEALTH<10 THEN HEALTH=HEALTH+1 2630 GOSUB 3200 !*************************gui UPDATE****** 2640 GOTO 2760 2650 IF LO0T(1,TLOOP1)<>96 THEN 2690 !zed 2660 SCORE=SCORE+75 :: HEALTH=HEALTH-1 :: IF HEALTH<=0 THEN 3260 2670 GOSUB 3200 !*************************gui UPDATE****** 2680 GOTO 2760 2690 IF LO0T(1,TLOOP1)<>112 THEN 2730 !melee 2700 SCORE=SCORE+25 :: IF MELEE<10 THEN MELEE=MELEE+1 2710 GOSUB 3200 !*************************gui UPDATE****** 2720 GOTO 2760 2730 IF LO0T(1,TLOOP1)<>113 THEN 2760 !ranged 2740 SCORE=SCORE+50 :: IF MELEE<10 THEN RANGED=RANGED+1 2750 GOSUB 3200 !*************************gui UPDATE****** 2760 CALL DELSPRITE(#DET):: SLOT=SLOT-1 ::GOTO 2800 !TEMP CODE - NEED TO GET PATTERNS TO IDENTIFY LOOT BEFORE BEHAVIOUR 2770 NEXT DET 2780 GOTO 2800 2790 FOR FALL=1 TO 24 :: YP=YP+1 :: CALL SPRITE(#1,44,6,YP,XP):: NEXT FALL !*****FALL********** 2800 RETURN 2810 REM *****************************************************BOARD**Progression************ 2820 CALL DELSPRITE(ALL):: BOARD=BOARD+1 :: RESTORE 170 :: GOTO 120 2830 REM ***********************************************************LOOT DISTRIBUTION SYSTEM****** 2840 SWITCH=INT(RND*2)+1 2850 FOR LT=1 TO 2 2860 LOOT=INT(RND*4)+1 2870 IF SWITCH=1 THEN 2880 ELSE 2890 2880 SWITCH=-5 :: GOTO 2920 2890 IF SWITCH=2 THEN 2900 ELSE 2910 2900 SWITCH=5 :: GOTO 2890 2910 IF SWITCH=5 THEN SWITCH=-5 ELSE SWITCH=5 2920 IF LOOT<>1 THEN 2960 2930 CALL SPRITE(#SLOT,88,7,GRND-9,((HLE+1)* +SWITCH* :: SLOT=SLOT+1 !HEART LOOT 2940 LO0T(LAB,LTN)=88 :: LAB=LAB+1 2950 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 2960 IF LOOT<>2 THEN 3000 2970 CALL SPRITE(#SLOT,96,4,GRND-9,((HLE+1)* +SWITCH* :: SLOT=SLOT+1 !ZED 2980 LO0T(LAB,LTN)=96 :: LAB=LAB+1 2990 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 3000 IF LOOT<>3 THEN 3040 3010 CALL SPRITE(#SLOT,112,8,GRND-9,((HLE+1)* +SWITCH* :: SLOT=SLOT+1 !MELEE 3020 LO0T(LAB,LTN)=112 :: LAB=LAB+1 3030 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 3040 IF LOOT<>4 THEN 3080 3050 CALL SPRITE(#SLOT,113,14,GRND-9,((HLE+1)* +SWITCH* :: SLOT=SLOT+1 !RANGED 3060 LO0T(LAB,LTN)=113 :: LAB=LAB+1 3070 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 3080 NEXT LT 3090 RETURN 3100 REM **********cOLLISION cHECK WALLs 3110 CALL POSITION(#1,YP,XP):: IF XP<=25 THEN 3120 ELSE 3150 3120 CALL COINC(#1,YP,4,8,C):: IF C<>0 THEN 3130 ELSE 3190 3130 CALL LOCATE(#1,YP,13):: CALL MOTION(#1,0,0) 3140 CALL JOYST(1,JX,JY):: IF JX=-4 THEN 3130 ELSE RETURN 3150 IF XP>=230 THEN 3160 ELSE 3190 3160 CALL COINC(#1,YP,247,8,C):: IF C<>0 THEN 3170 ELSE 3190 3170 CALL LOCATE(#1,YP,239):: CALL MOTION(#1,0,0) 3180 CALL JOYST(1,JX,JY):: IF JX=4 THEN 3170 ELSE RETURN 3190 RETURN 3200 REM ********************GUI*********** 3210 DISPLAY AT(1,4):SCORE :: DISPLAY AT(1,11):BOARD :: DISPLAY AT(1,16):HEALTH :: DISPLAY AT(1,22):MELEE :: DISPLAY AT(1,27):RANGED !Output GUI 3220 CALL VCHAR(1,4,120):: CALL VCHAR(1,5,121):: CALL VCHAR(1,6,122)!score text gui 3230 CALL VCHAR(1,13,123):: CALL VCHAR(1,18,123):: CALL VCHAR(1,24,123):: CALL VCHAR(1,29,123)!Xs gui 3240 CALL VCHAR(1,12,124):: CALL VCHAR(1,17,88):: CALL VCHAR(1,23,112):: CALL VCHAR(1,28,113)!BOARD,hearts,melee,ranged gui 3250 RETURN 3260 REM ******************************YOU ARE DEAD*********************** 3270 CALL MOTION(#1,0,0):: CALL DELSPRITE(ALL):: CALL SCREEN(10) 3280 DATA 89,0044442810101010,79,007C44444444447C,85,0044444444444438 3290 DATA 65,003844447C444444,82,0078444478504844,69,007C40407840407C 3300 DATA 68,0078242424242478 3310 FOR YAD=1 TO 7 3320 READ YADC,YADP$ 3330 CALL CHAR(YADC,YADP$) 3340 NEXT YAD 3350 CALL CLEAR 3360 CALL VCHAR(12,10,89):: CALL VCHAR(12,11,79):: CALL VCHAR(12,12,85):: CALL VCHAR(12,13,32)!YOU 3370 CALL VCHAR(12,14,65):: CALL VCHAR(12,15,82):: CALL VCHAR(12,16,69):: CALL VCHAR(12,17,32)!ARE 3380 CALL VCHAR(12,18,68):: CALL VCHAR(12,19,69):: CALL VCHAR(12,20,65):: CALL VCHAR(12,21,68)!DEAD 3390 FOR CLRS=1 TO 13 :: CALL COLOR(CLRS,16,1):: NEXT CLRS 3400 CALL SCREEN(2) 3410 GOSUB 3200 3420 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 3600 :: IF K=6 THEN 3430 ELSE 3440 3430 CALL DELSPRITE(ALL):: RESTORE 170 :: GOTO 100 3440 CALL JOYST(1,JX,JY):: IF JX=0 THEN 3420 :: IF JY=0 THEN 3420 ELSE 3430 3450 REM*******************MAN MELEE ATTACK 3460 CALL SOUND(100,10000,0) 3470 RETURN 3480 CALL SOUND(100,-6,0) 3490 RETURN 3500 REM*****************ZED COLLISION BEHAVIOR************* 3510 RETURN 3520 REM****************ZED ATTACK****************** 3530 RETURN 3540 REM *****JOYS Combat choice***** 3550 IF JY=4 THEN 3560 ELSE 3570 3560 GOSUB 3450 :: GOTO 3590 3570 IF JY=-4 THEN 3580 ELSE 3590 3580 GOSUB 3480 3590 RETURN 3600 REM***quit game 3610 CALL CLEAR 3620 END Edited August 18, 2016 by Sinphaltimus Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 18, 2016 Author Share Posted August 18, 2016 (edited) Ever forget to type "run" one last time before you upload code?Yeah.OK, post above this with v027 is working. Nothing broken.Also the original post updated to working. Edited August 18, 2016 by Sinphaltimus Quote Link to comment Share on other sites More sharing options...
Opry99er Posted August 19, 2016 Share Posted August 19, 2016 (edited) Music is possible in the background, but I believe only one of the ways will work for your chosen medium. XB256 can be used to put music in the background. Matthew180's XB soundlist player can also be used. XB256 would likely be your best bet here, as the soundlist player by Matthew180 requires assembly subroutines on disk. The compiler does not recognize the commands that are required to load and link the assembly. XB256 on the other hand has it all built into one, along with many other excellent tools including scrolling text and screen swapping. It also compiles into EA5 format and would work with the FR99, unless I am gravely mistaken. I used matthew's soundlist player in two of my games... 'Riding for the Brand' and 'Honeycomb Rapture'... Both of which can be found on the gameshelf. I love that soundlist player. Edited August 19, 2016 by Opry99er 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 19, 2016 Author Share Posted August 19, 2016 I'm going to save music for near the end. Right now I'm attempting to setup event driven collision detection for the zombies against melee weapons and I'm finding it very difficult without having to cycle through sprite numbers in an array which is a very hard performance hit.I WISH we could do call coinc(#sprite,ALL,tolerance,numeric). Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 19, 2016 Author Share Posted August 19, 2016 (edited) Quick question: how do I dynamically create variables? I want to track health individually for multiple enemies. I'm thinking this, find the enemy in the array for example Sprite #1 create a variable called ehelth+sprite number find enemey in array sprite#2 create variable ehelth+sprite#2 so I end up with 2 different variables ehelth1 and ehelth2 with ehelth being assigned to sprite #1 and 2 respectively. (when ever sp1 is attacked I adjust ehelth1 value, etc..)I'm asking so I don't get side tracked too much away from what I'm doing right now. I'll try and find the answer myself but my track record with TI basic functions isn't that great at all. I suppose I could just expand my array to store each enemy health individually and run the checks from there... Edited August 19, 2016 by Sinphaltimus Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 19, 2016 Share Posted August 19, 2016 (edited) All numeric variables are created before the program starts to run. In a so-called prescan. I would make an array like this 100 DIM H(28) Obviously the index is the sprite number. Sprite #1 is associated with H(1) etc. All 28 variables are initialized with the value zero - like with any other numeric variable. Running over the DIM once more won't reinitialize them. Edited August 19, 2016 by sometimes99er Quote Link to comment Share on other sites More sharing options...
+adamantyr Posted August 19, 2016 Share Posted August 19, 2016 The best way to have dynamic re-sizing variables is to use strings to store values. A single string can store up to 255 characters, or 255 values from 0-255. The limitations of this approach are as follows: You have to use ASC(SEG$()) to extract values back into numerics for calculations, which can be a slight drag on performance, especially for an action game You can only store integer values (floating point is possible but I don't think it would be worth doing) Those integer values are only 0-255, unless you store values in two or more bytes at a chunk, which makes for extra processing time. In this case, I think the idea of using a fixed array is the better approach, because performance-wise it will be faster. 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 20, 2016 Author Share Posted August 20, 2016 The best way to have dynamic re-sizing variables is to use strings to store values. A single string can store up to 255 characters, or 255 values from 0-255. The limitations of this approach are as follows: You have to use ASC(SEG$()) to extract values back into numerics for calculations, which can be a slight drag on performance, especially for an action game You can only store integer values (floating point is possible but I don't think it would be worth doing) Those integer values are only 0-255, unless you store values in two or more bytes at a chunk, which makes for extra processing time. In this case, I think the idea of using a fixed array is the better approach, because performance-wise it will be faster. Makes sense to go with array. It's only 14 sprites at most to track on any given board and once I know the sprite number I'll know the hp value for it. I've made a lot of progress on a complicated issue while also improving over-all performance ever so slightly. New version coming up soon. This version now has a game purpose. Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 20, 2016 Author Share Posted August 20, 2016 GAME IS CURRENTLY EARLY ACCESS ALPHA version. No ETA on Beta. I will update this code below to the latest version when ever announced in a new comment so you don't have to go searching.Just copy/paste from below OR download the class99 save dsk1.ZOMBI029 file that is attached >>here<<: How To Play: About: This is meant to be a semi casual zombie survival game to escape a skyscraper. Play for score (session high score coming soon) Combat: A melee attack is a swing attack that covers the space directly in front and behind the player. You get one attack per inventory item. Joystick down = ranged attack temporarily using a noise for place holder. ZEDS: Will grab you and attack you. Hold a direction to escape, try hitting with melee, break away as fast as you can. DODGE: You can attempt to dodge zeds by jumping past them (joystick button or J) Controls: X=Quit, R=Reset, J and Controller Button = Jump, Joystick Left/Right moves left/right, Joystick up = melee attack - Notes: Melee attacks will destroy loot including hearts. Be careful not to use up all your melee weapons. Version 029 changes (*8/19/16) : Started high score frame work.. Zeds no longer die when in contact with player. Must be killed with Melee or Dodged for now. Added some sounds. ADJUSTED SCORING Fixed issue running across bottom floor caused by unused hole spawning there. Optimize COINC calls in regards to man vs loot and man vs wall. UNRELEASED: V028 changes: Major inefficiencies in dealing with sprites and sprite generation resolved Optimized coinc calls for better performance in regards to melee coinc detection Melee weapon attack system completed. To Do Next:Create attacks for ranged including inventory changes Replace temp zombi health with per sprite health. right now they share 2hps and it gets reset to 2 at each death. Create basic zombie AI and animate. session high score KNOW ISSUES:No known bugs at this time. Not all functionality or game mechanics have been developed as of this version. To Do Long Term: Title screen. Sounds Music. Loot balancing with board progression. (game balancing) zombie difficulty linked to board progression. At least 2 more types of ever more difficult zombies. Change Log: Version 027 changes (*8/18/16) - X=Quit, R=Reset, J and Controller Button = Jump, Joystick Left/Right moves left/right, Joystick up = melee attack temporarily using just a high pitched sound for place holder. Joystick down = ranged attack temporarily using a noise for place holder. Adjusted running animations slightly. Set up weapon inventory. Entered new CHAR patterns and codes for ZEDS and combat. Setup empty framework for zed coinc and combat. version 0.26-081516 Level Progression Working with new GUI element. *Pushing Joystick up or down RESETS the game. Board progression works via the EXIT. Zombies do -1 heart/health damage. 0 health = death. Hearts = +1 health, 10 max. FIXED*Sometimes holes don't spawn where holes are supposed to spawn causing a "no exit" situation. I dunno why yet.FIXED*Sometimes loot doesn't spawn where it is supposed to. I dunno why yet. FIXED*Sometimes the player falls through the girders near or very far from the hole. I dunno why yet. New death screen. When at this screen, press any key, move joystick to push joystick button to play again. 100 SCORE=0000 :: HEALTH=10 :: BOARD=1 :: HSCORE=0 120 MELEE=0 :: RANGED=0 !weapons inventory 140 CALL SCREEN(2) 160 CALL COLOR(10,15,1):: CALL COLOR(12,12,1):: CALL COLOR(3,12,1):: CALL COLOR(4,12,1) 180 CALL COLOR(8,7,1):: CALL COLOR(11,8,1):: CALL COLOR(14,12,1) 200 CALL CLEAR 220 !running patterns right 240 DATA 1818101010101018,1818183C1C142630,181A3C5E1A334060,18197E981C724100,18197E9818147243,1818385E581C2436 260 !stop and jump right 280 DATA 1818101010101018,000C1C3058081018,00000C1C305C1C18,0000060E183C0C18,0003070C18081018 300 !jumping right 320 DATA 0303040609081010,1818141810106000,1818103810180C00,1818503010180404 340 !landing right 360 DATA 0018183050180818,1818101038501018 380 !running patterns left 400 DATA 1818080808080818,1818183C3828640C,18583C7A58CC0206,18987E19384E8200,18987E1918284EC2,18181C7A1A38246C 420 !stop and jump left 440 DATA 1818080808080818,0030380C1A100818,000030380C3A3818,00006070183C3018,00C0E03018100818 460 !jumping left 480 DATA C0C0206090100808,1818281808080600,1818081C08183000,18180A0C08182020 500 !landing right 520 DATA 0018180C0A181018,181808081C0A0818 540 FOR CHRR=33 TO 38 !setup for creating running characters right 560 READ PAT$ 580 CALL CHAR(CHRR,PAT$) 600 NEXT CHRR 620 REM CHR=CHRR 640 FOR CHSR=39 TO 43 !setup for creating stop and jump characters right 660 READ PAT$ 680 CALL CHAR(CHSR,PAT$) 700 NEXT CHSR 720 FOR CHJR=64 TO 67 !setup for creating jumping characters right 740 READ PAT$ 760 CALL CHAR(CHJR,PAT$) 780 NEXT CHJR 800 FOR CHLR=68 TO 69 !setup for creating landing characters right 820 READ PAT$ 840 CALL CHAR(CHLR,PAT$) 860 NEXT CHLR 880 REM left running*********************** 900 FOR CHRL=70 TO 75 !setup for creating running characters left 920 READ PAT$ 940 CALL CHAR(CHRL,PAT$) 960 NEXT CHRL 980 FOR CHSL=76 TO 80 !setup for creating stop and jump characters left 1000 READ PAT$ 1020 CALL CHAR(CHSL,PAT$) 1040 NEXT CHSL 1060 FOR CHJL=81 TO 84 !setup for creating jumping characters left 1080 READ PAT$ 1100 CALL CHAR(CHJL,PAT$) 1120 NEXT CHJL 1140 FOR CHLL=85 TO 86 !setup for creating landing characters left 1160 READ PAT$ 1180 CALL CHAR(CHLL,PAT$) 1200 NEXT CHLL 1220 BGIR$="3C4426D999A5C3FF" !BAD girder for level HOLE creation 1240 GIR$="FFC3A59999A5C3FF" !GIRDER FOR LEVELS 1260 CALL CHAR(104,BGIR$,105,GIR$)!girder for level creation 1280 GRAV$="FFFFFFFFFFFFFFFF" :: CALL CHAR(106,GRAV$)!THE HOLE 1300 EXT$="1F1111111D11111F" :: CALL CHAR(107,EXT$)!THE EXIT 1320 HRT$="66FFFFFF7E7E3C18" :: CALL CHAR(88,HRT$)!THE HEART 1340 ZED$="3C2418FF9918183C" :: CALL CHAR(96,ZED$)!THE ZED 1360 MLE$="C0E0703A1E0C1A01" :: CALL CHAR(112,MLE$)!MELEE 1380 RNG$="000000FF7F1E1606" :: CALL CHAR(113,RNG$)!RANGED WEAPONS 1400 SCTXT1$="70808063141414E3" :: SCTXT2$="00000000334A4A32" :: SCTXT3$="00000000993C2118" !Word Score 1420 CALL CHAR(120,SCTXT1$):: CALL CHAR(121,SCTXT2$):: CALL CHAR(122,SCTXT3$) 1440 EXTXT$="0044442810284444" :: CALL CHAR(123,EXTXT$)! the letter X remain for GUI 1460 LVLTXT$="E0E080E9EF86EFE9" :: CALL CHAR(124,LVLTXT$)! EX TEXT IN GUI 1480 IDLE$="3838107CBA38286C" :: CALL CHAR(44,IDLE$)!***IDLE MAN 1500 MMELE$="3C3C18FF7E3C183C" :: MRNGL$="0C0C04FC4C3C286C" :: MRNGR$="3030203F323C1436" ! MELEE & l/r RANGED ATTACKS 1520 MWA$="002418FF1824" :: BULET$="0000008" !WEAPONS FIRE 1540 ZDI$="3C2418FF9918183C" :: ZDA$="3CA5DB7E1818183C" :: ZWL1$="3C2C18F81838246C" :: ZWL2$="3C2C18F818181838" !ZED IDLE&WALK LEFT 1560 ZWR1$="3C34181F181C2436" :: ZWR2$="3C34181F1818181C" !ZED WALK RIGHT 1580 CALL CHAR(45,MMELE$,46,MRNGL$,47,MRNGR$)!MAN ATTTACKS 1600 CALL CHAR(143,MWA$,142,BULET$)!WEAPONS FIRE 1620 RANDOMIZE 1640 SLOT=10 !STARTING SPRITE NUMBER FOR LOOT and more 1660 OPTION BASE 1 1680 DIM LO0T(2,14)!LOOT DISTRIBUTION AND COLLISION. 1700 LTN=1 !LOOT ARRAY COORDS COL 1720 LAB=1 !LOOT ARRAY COORDS ROW 1740 SHL=2 :: GRND=17 !START ground level on top girder (YP+8pixels), LEVEL AND SPRITE HOLE # 1760 LVL=3 :: YP=9 :: XP=8 :: RS=0 :: CS=16 :: RSPD=2 !start pos,vel,controller run speed multiplier rspd 1780 ZHELTH=2 !default health of zombies start of game 1800 GOSUB 4500 !*******************************Create Level 1820 REM***************************************Create Sprite Idle******** 1840 CALL SPRITE(#1,44,6,YP,XP) 1860 CALL JOYST(1,JX,JY):: !check for joystick input 1880 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 1900 ELSE 1920 1900 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 1920 IF JY=0 THEN 1960 ELSE 1940 1940 GOSUB 7200 1960 CALL COINC(ALL,C):: IF C=0 THEN 2000 ELSE 1980 !collision check 1980 GOSUB 4940 !collision actions 2000 GOSUB 6160 !*************WALL COLLISION CHECK 2020 IF K<>18 AND K<>74 AND K<>106 THEN 3360 !no kb pressed check for joyst 2040 REM ********jump routine check******** 2060 CALL MOTION(#1,0,0) 2080 IF CS<>-16 THEN 2160 2100 CALL POSITION(#1,YP,XP)!get new position for next sprite 2120 GOSUB 2240 ! goto jump left 2140 GOTO 1820 2160 IF CS<>16 THEN 3360 2180 CALL POSITION(#1,YP,XP)!get new position for next sprite 2200 GOSUB 2800 !goto jump right************************** 2220 GOTO 1820 2240 REM *************jump left routine********* 2260 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! 2280 CALL SPRITE(#1,CHSL,6,YP,XP)!recreate sprite1 as stop and jump characters 2300 FOR PT=76 TO 80 !setup stop and jump animation left 2320 CALL PATTERN(#1,PT)!ANIMATE 2340 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2360 NEXT DELAY 2380 NEXT PT !continue animating the stop and jump until done 2400 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping 2420 IF XP<=24 THEN 2620 2440 CS=-20 :: YP=YP-3 :: RS=0 :: CALL SPRITE(#1,CHJL,6,YP,XP,RS,CS)!jumping left 2460 FOR PT=81 TO 84 2480 CALL PATTERN(#1,PT) 2500 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2520 NEXT DELAY 2540 NEXT PT 2560 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 2580 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 2600 YP=YP+3 !RESET YP TO BE GROUND. 2620 CALL SPRITE(#1,CHLL,6,YP,XP) 2640 FOR PT=85 TO 86 !setup landing animation left 2660 CALL PATTERN(#1,PT) 2680 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2700 NEXT DELAY 2720 NEXT PT ! continue landing animation until last frame 2740 CALL POSITION(#1,YP,XP)!get new position for next sprite 2760 CS=-16 2780 RETURN 2800 REM *************jump right routine****** 2820 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! right 2840 CALL SPRITE(#1,CHSR,6,YP,XP)!recreate sprite1 as stop and jump characters right 2860 FOR PT=39 TO 43 !setup stop and jump animation right 2880 CALL PATTERN(#1,PT) 2900 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2920 NEXT DELAY 2940 NEXT PT !continue animating the stop and jump until done right 2960 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping right 2980 IF XP>=224 THEN 3180 3000 CS=20 :: YP=YP-3 :: CALL SPRITE(#1,CHJR,6,YP,XP,RS,CS)!jumping right 3020 FOR PT=64 TO 67 !setup jumping characters right 3040 CALL PATTERN(#1,PT) 3060 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 3080 NEXT DELAY 3100 NEXT PT 3120 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 3140 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 3160 YP=YP+3 3180 CALL SPRITE(#1,CHLR,6,YP,XP) 3200 FOR PT=68 TO 69 !setup landing animation 3220 CALL PATTERN(#1,PT) 3240 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 3260 NEXT DELAY 3280 NEXT PT ! continue landing animation until last frame 3300 CALL POSITION(#1,YP,XP)!get new position for next sprite 3320 CS=16 3340 RETURN 3360 REM **************Check Joyst Options************ 3380 IF JX<>0 THEN 3440 3400 CALL MOTION(#1,0,0) 3420 GOTO 1860 3440 REM ********running check*************** 3460 IF JX<>-4 THEN 3520 3480 CALL POSITION(#1,YP,XP)!get new position for next sprite 3500 GOSUB 4040 3520 IF JX<>4 THEN 1860 3540 CALL POSITION(#1,YP,XP)!get new position for next sprite 3560 GOSUB 3600 3580 GOTO 1860 !after RETURN goto joyst check 3600 REM ************run right routine******** 3620 CS=16 :: CALL SPRITE(#1,CHRR,6,YP,XP)!create the runner and send running 3640 CALL MOTION(#1,0,JX*RSPD) 3660 FOR PT=33 TO 38 STEP 2 !setup for animating the run right 3680 CALL PATTERN(#1,PT) 3700 CALL JOYST(1,JX,JY):: !check for joystick input 3720 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 3740 ELSE 3760 3740 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 3760 CALL COINC(ALL,C):: IF C=0 THEN 3800 ELSE 3780 !collision check 3780 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 4940 !collision actions 3800 GOSUB 6160 !*************WALL COLLISION CHECK 3820 IF JY=0 THEN 3860 ELSE 3840 3840 GOSUB 7200 3860 IF JX<>0 THEN 3900 ELSE 3880 !not joy pressed keep running 3880 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 3900 IF JX=4 THEN 3940 3920 IF JX=-4 THEN 4020 3940 CALL MOTION(#1,0,JX*RSPD) 3960 NEXT PT 3980 IF JX=4 THEN 3660 4000 CALL POSITION(#1,YP,XP)!check position and store before stopping motion 4020 RETURN 4040 REM **********run left routine************** 4060 CS=-16 :: CALL SPRITE(#1,CHRL,6,YP,XP)!create the runner and send running 4080 CALL MOTION(#1,0,JX*RSPD) 4100 FOR PT=70 TO 75 STEP 2 !setup for animating the run left 4120 CALL PATTERN(#1,PT) 4140 CALL JOYST(1,JX,JY)!check for joystick input 4160 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 4180 ELSE 4200 4180 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 4200 CALL COINC(ALL,C):: IF C=0 THEN 4240 ELSE 4220 !collision check 4220 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 4940 !collision actions 4240 IF xp<=23 OR XP>=230 THEN 4250 ELSE 4260 4250 GOSUB 6160 !*************WALL COLLISION CHECK 4260 IF JY=0 THEN 4300 ELSE 4280 4280 GOSUB 7200 4300 IF JX<>0 THEN 4340 ELSE 4320 !not joy pressed keep running 4320 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 4340 CALL JOYST(1,JX,JY) 4360 IF JX=-4 THEN 4400 4380 IF JX=4 THEN 4480 4400 CALL MOTION(#1,0,JX*RSPD) 4420 NEXT PT 4440 IF JX=-4 THEN 4100 4460 CALL POSITION(#1,YP,XP)!check position and store for next sprite 4480 RETURN 4500 REM *************************************************************************level creation************************ 4520 GOSUB 6360 !*************************gui creation****** 4540 HLE=INT((RND*15)+5) 4560 FOR LVL=1 TO 8 4580 IF LVL=1 THEN 4620 4600 GOSUB 5620 !*************************************GOSUB********LOOT********** 4620 CALL VCHAR(1,1,105,24)!LEFT WALL 4640 CALL VCHAR(1,32,105,24)!RIGHT WALL 4660 CALL HCHAR(LVL*3,1,105,HLE-1)!LEFT SIDE GIRDERS 4680 IF LEVEL=8 THEN 4700::CALL SPRITE(#SHL,106,1,GRND-3,(HLE*+1)!HOLE PROPER 4690 SHL=SHL+1 !ADVANCE SPRITE # 4700 CALL HCHAR(LVL*3,HLE+3,105,32-(HLE+3))!RIGHT SIDE Girders 4720 CALL HCHAR(LVL*3,HLE,104)!CRUMBLE LEFT SIDE 4740 CALL HCHAR(LVL*3,HLE+2,104)!crumble right side 4760 GRND=GRND+24 4780 HOL=INT((RND*15)+5)!NEW LOCATION FOR HOLE 4800 IF HOL=HLE THEN 4780 !NOT EQUAL TO PREVIOUS HOLE 4820 HLE=HOL !SET PROPER HOLE VARIABLE 4860 NEXT LVL !GO CREATE NEXT LEVEL 4880 CALL SPRITE(#9,107,15,22*8,30*! THE EXIT 4900 CALL HCHAR(24,1,105,31)!THE FLOOR 4920 RETURN 4940 REM *****************************************************************collision action******* 4960 CALL COINC(#1,#9,4,C):: IF C<>0 THEN 5580 ELSE 4980 !****collision check against exit 4980 FOR DET=2 TO 8 !there are 7 holes to check against. 5000 CALL COINC(#1,#DET,6,C)!**************************collision check against holes 5020 IF C<>0 THEN 5540 ELSE 5040 5040 NEXT DET 5060 FOR DET=10 TO 23 !************************collision check against LOOT********************* 5080 CALL COINC(#1,#DET,6,C) 5100 IF C=0 THEN 5120 ELSE 5130 5120 NEXT DET 5125 RETURN 5130 TLOOP1=DET-9 5180 IF LO0T(1,TLOOP1)<>88 THEN 5260 !heart 5200 SCORE=SCORE+8 :: IF HEALTH<10 THEN HEALTH=HEALTH+1 5220 GOSUB 6360 !*************************gui UPDATE****** 5240 GOTO 5480 5260 IF LO0T(1,TLOOP1)<>96 THEN 5340 !******ZED*********** 5280 CALL SOUND(100,-4,0,110,0,1000,0)::HEALTH=HEALTH-1 :: IF HEALTH<=0 THEN 6480 5300 GOSUB 6360 !*************************gui UPDATE****** 5320 RETURN 5340 IF LO0T(1,TLOOP1)<>112 THEN 5420 !melee 5360 SCORE=SCORE+3 :: IF MELEE<10 THEN MELEE=MELEE+1 5380 GOSUB 6360 !*************************gui UPDATE****** 5400 GOTO 5480 5420 IF LO0T(1,TLOOP1)<>113 THEN 5480 !ranged 5440 SCORE=SCORE+5 :: IF MELEE<10 THEN RANGED=RANGED+1 5460 GOSUB 6360 !*************************gui UPDATE****** 5480 CALL DELSPRITE(#DET)::GOTO 5560 5520 GOTO 5560 5540 FOR FALL=1 TO 24 :: YP=YP+1 :: CALL SPRITE(#1,44,6,YP,XP):: NEXT FALL !*****FALL********** 5560 RETURN 5580 REM *****************************************************BOARD**Progression************ 5600 CALL DELSPRITE(ALL):: BOARD=BOARD+1 :: RESTORE 240::IF SCORE>HSCORE THEN HSCORE=SCORE::GOTO 140 5620 REM ***********************************************************LOOT DISTRIBUTION SYSTEM****** 5640 SWITCH=INT(RND*2)+1 5660 FOR LT=1 TO 2 5680 LOOT=INT(RND*4)+1 5700 IF SWITCH=1 THEN 5720 ELSE 5740 5720 SWITCH=-5 :: GOTO 5800 5740 IF SWITCH=2 THEN 5760 ELSE 5780 5760 SWITCH=5 :: GOTO 5740 5780 IF SWITCH=5 THEN SWITCH=-5 ELSE SWITCH=5 5800 IF LOOT<>1 THEN 5880 5820 CALL SPRITE(#SLOT,88,7,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !HEART LOOT 5840 LO0T(LAB,LTN)=88 :: LAB=LAB+1 5860 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 5880 IF LOOT<>2 THEN 5960 5900 CALL SPRITE(#SLOT,96,4,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !ZED 5920 LO0T(LAB,LTN)=96 :: LAB=LAB+1 5940 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 5960 IF LOOT<>3 THEN 6040 5980 CALL SPRITE(#SLOT,112,8,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !MELEE 6000 LO0T(LAB,LTN)=112 :: LAB=LAB+1 6020 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 6040 IF LOOT<>4 THEN 6120 6060 CALL SPRITE(#SLOT,113,14,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !RANGED 6080 LO0T(LAB,LTN)=113 :: LAB=LAB+1 6100 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 6120 NEXT LT 6140 RETURN 6160 REM **********cOLLISION cHECK WALLs 6180 CALL COINC(#1,YP,4,8,C):: IF C<>0 THEN 6220 ELSE 6280 6220 CALL LOCATE(#1,YP,13):: CALL MOTION(#1,0,0) 6240 CALL JOYST(1,JX,JY):: IF JX=-4 THEN 6220 ELSE RETURN 6260 IF XP>=230 THEN 6280 ELSE 6340 6280 CALL COINC(#1,YP,247,8,C):: IF C<>0 THEN 6300 ELSE 6340 6300 CALL LOCATE(#1,YP,239):: CALL MOTION(#1,0,0) 6320 CALL JOYST(1,JX,JY):: IF JX=4 THEN 6300 ELSE RETURN 6340 RETURN 6360 REM ********************GUI*********** 6380 DISPLAY AT(1,4):SCORE :: DISPLAY AT(1,11):BOARD :: DISPLAY AT(1,16):HEALTH :: DISPLAY AT(1,22):MELEE :: DISPLAY AT(1,27):RANGED !Output GUI 6400 CALL VCHAR(1,4,120):: CALL VCHAR(1,5,121):: CALL VCHAR(1,6,122)!score text gui 6420 CALL VCHAR(1,13,123):: CALL VCHAR(1,18,123):: CALL VCHAR(1,24,123):: CALL VCHAR(1,29,123)!Xs gui 6440 CALL VCHAR(1,12,124):: CALL VCHAR(1,17,88):: CALL VCHAR(1,23,112):: CALL VCHAR(1,28,113)!BOARD,hearts,melee,ranged gui 6460 RETURN 6480 REM ******************************YOU ARE DEAD*********************** 6500 CALL MOTION(#1,0,0):: CALL DELSPRITE(ALL):: CALL SCREEN(10) 6520 DATA 89,0044442810101010,79,007C44444444447C,85,0044444444444438 6540 DATA 65,003844447C444444,82,0078444478504844,69,007C40407840407C 6560 DATA 68,0078242424242478 6580 FOR YAD=1 TO 7 6600 READ YADC,YADP$ 6620 CALL CHAR(YADC,YADP$) 6640 NEXT YAD 6660 CALL CLEAR 6680 CALL VCHAR(12,10,89):: CALL VCHAR(12,11,79):: CALL VCHAR(12,12,85):: CALL VCHAR(12,13,32)!YOU 6700 CALL VCHAR(12,14,65):: CALL VCHAR(12,15,82):: CALL VCHAR(12,16,69):: CALL VCHAR(12,17,32)!ARE 6720 CALL VCHAR(12,18,68):: CALL VCHAR(12,19,69):: CALL VCHAR(12,20,65):: CALL VCHAR(12,21,68)!DEAD 6740 FOR CLRS=1 TO 13 :: CALL COLOR(CLRS,16,1):: NEXT CLRS 6760 CALL SCREEN(2) 6780 GOSUB 6360 6800 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 6820 ELSE 6840 6820 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 6840 CALL JOYST(1,JX,JY):: IF JX=0 THEN 6800 :: IF JY=0 THEN 6800 ELSE 6820 6860 REM*******************MAN MELEE ATTACK 6880 CALL PATTERN(#1,45)!melee attack pattern 6900 CALL SPRITE(#24,143,12,YP,XP+:: CALL SOUND(125,-5,0)!right attack 6920 GOSUB 7460 6940 CALL DELSPRITE(#24) 6960 CALL SPRITE(#25,143,12,YP,XP-:: CALL SOUND(125,-6,0)!left attack 6980 GOSUB 7560 7000 CALL DELSPRITE(#25) 7020 CALL PATTERN(#1,44):: RETURN 7040 REM ******************MAN RANGED ATTACK 7060 CALL SOUND(100,-6,0):: RETURN 7080 !IF KSLOT=1 THEN 7090::RETURN 7100 !KSLOT=0::SLOT=SLOT-1::RETURN 7120 REM*****************ZED COLLISION BEHAVIOR************* 7140 RETURN 7160 REM****************ZED ATTACK****************** 7180 RETURN 7200 REM *****JOYS Combat choice***** 7220 IF MELEE>=1 THEN 7260 ELSE 7240 7240 CALL SOUND(100,-3,0):: RETURN 7260 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP) 7280 IF JY=4 THEN 7300 ELSE 7340 7300 MELEE=MELEE-1 :: GOSUB 6360 !*******UPDATE GUI 7320 GOSUB 6860 :: RETURN 7340 IF JY=-4 THEN 7360 ELSE 7380 7360 GOSUB 7060 7380 RETURN 7400 REM***quit game 7420 CALL CLEAR 7440 END 7460 FOR DET=10 TO 23 !************************mELEE collision check against LOOT********************* 7480 CALL COINC(#24,#DET,7,C) 7500 IF C<>0 THEN 7640 ELSE 7520 7520 NEXT DET 7540 RETURN 7560 FOR DET=10 TO 23 7580 CALL COINC(#25,#DET,7,C) 7600 IF C<>0 THEN 7640 ELSE 7620 7620 NEXT DET :: RETURN 7640 TLOOP1=DET-9 7660 IF LO0T(1,TLOOP1)<>88 THEN 7680 ELSE 7840 !heart 7680 IF LO0T(1,TLOOP1)<>96 THEN 7780 !zed - ALL ALPHA TEMP CODE 7700 ZHELTH=ZHELTH-1 :: IF ZHELTH>=1 THEN 7860 7720 SCORE=SCORE+10 :: ZHELTH=2 7740 GOSUB 6360 !*************************gui UPDATE****** 7760 GOTO 7840 7780 IF LO0T(1,TLOOP1)<>112 THEN 7820 !melee 7800 GOTO 7840 7820 IF LO0T(1,TLOOP1)<>113 THEN 7860 !ranged 7840 CALL DELSPRITE(#DET):: RETURN 7860 RETURN ZOMBi Whether or not you've been following this thread :http://atariage.com/forums/topic/254360-graphics-on-your-ti-are-you-interested/ I hope you'll enjoy this. I started doing animation and graphics stuff on that other thread. Then I started using joystick controls etc.. I made a little pixel man that runs and jump. Then I added a random hole he could fall in to or jump over. Then I got an idea for a game so I'm going to make it. It's called ZOMBi. Something that says Zombie game for the ti? Maybe I'll change it, been on the fence with ZOMBi99er. Anyway, I'll use this thread to share the code and progress. GAME IS CURRENTLY EARLY ACCESS ALPHA version. No ETA on Beta. I will update this code below to the latest version when ever announced in a new comment so you don't have to go searching. Just copy/paste from below OR download the class99 save dsk1.ZOMBI029 file that is attached here: How To Play: About: This is meant to be a semi casual zombie survival game to escape a skyscraper. Play for score (session high score coming soon) Combat: A melee attack is a swing attack that covers the space directly in front and behind the player. You get one attack per inventory item. Joystick down = ranged attack temporarily using a noise for place holder. ZEDS: Will grab you and attack you. Hold a direction to escape, try hitting with melee, break away as fast as you can. DODGE: You can attempt to dodge zeds by jumping past them (joystick button or J) Controls: X=Quit, R=Reset, J and Controller Button = Jump, Joystick Left/Right moves left/right, Joystick up = melee attack - Notes: Melee attacks will destroy loot including hearts. Be careful not to use up all your melee weapons. Version 029 changes (*8/19/16) : Started high score frame work.. Zeds no longer die when in contact with player. Must be killed with Melee or Dodged for now. Aded some sounds. ADJUSTED SCORING Fixed issue running across bottom floor caused by unused hole spawning there. Optimize COINC calls in regards to man vs loot and man vs wall. UNRELEASED: V028 changes: Major inefficiencies in dealing with sprites and sprite generation resolved Optoimized coinc calls for better performance in regards to melee coinc detection Melee weapon attack system completed. To Do Next: Create attacks for ranged including inventory changes Replace temp zombihealth with per sprite health. right now they share 2hps and it gets reset to 2 at each death. Create basic zombie AI and animate. session high score KNOW ISSUES: No known bugs at this time. Not all functionality or game mechanics have been developed as of this version. To Do Long Term: Title screen. Sounds Music. Loot balancing with board progression. (game balancing) zombie difficulty linked to board progression. At least 2 more types of ever more difficult zombies. Change Log: Version 027 changes (*8/18/16) - X=Quit, R=Reset, J and Controller Button = Jump, Joystick Left/Right moves left/right, Joystick up = melee attack temporarily using just a high pitched sound for place holder. Joystick down = ranged attack temporarily using a noise for place holder. Adjusted running animations slightly. Set up weapon inventory. Entered new CHAR patterns and codes for ZEDS and combat. Setup empty framework for zed coinc and combat. version 0.26-081516 Level Progression Working with new GUI element. *Pushing Joystick up or down RESETS the game. Board progression works via the EXIT. Zombies do -1 heart/health damage. 0 health = death. Hearts = +1 health, 10 max. FIXED*Sometimes holes don't spawn where holes are supposed to spawn causing a "no exit" situation. I dunno why yet. FIXED*Sometimes loot doesn't spawn where it is supposed to. I dunno why yet. FIXED*Sometimes the player falls through the girders near or very far from the hole. I dunno why yet. New death screen. When at this screen, press any key, move joystick to push joystick button to play again. 100 SCORE=0000 :: HEALTH=10 :: BOARD=1 :: HSCORE=0 120 MELEE=0 :: RANGED=0 !weapons inventory 140 CALL SCREEN(2) 160 CALL COLOR(10,15,1):: CALL COLOR(12,12,1):: CALL COLOR(3,12,1):: CALL COLOR(4,12,1) 180 CALL COLOR(8,7,1):: CALL COLOR(11,8,1):: CALL COLOR(14,12,1) 200 CALL CLEAR 220 !running patterns right 240 DATA 1818101010101018,1818183C1C142630,181A3C5E1A334060,18197E981C724100,18197E9818147243,1818385E581C2436 260 !stop and jump right 280 DATA 1818101010101018,000C1C3058081018,00000C1C305C1C18,0000060E183C0C18,0003070C18081018 300 !jumping right 320 DATA 0303040609081010,1818141810106000,1818103810180C00,1818503010180404 340 !landing right 360 DATA 0018183050180818,1818101038501018 380 !running patterns left 400 DATA 1818080808080818,1818183C3828640C,18583C7A58CC0206,18987E19384E8200,18987E1918284EC2,18181C7A1A38246C 420 !stop and jump left 440 DATA 1818080808080818,0030380C1A100818,000030380C3A3818,00006070183C3018,00C0E03018100818 460 !jumping left 480 DATA C0C0206090100808,1818281808080600,1818081C08183000,18180A0C08182020 500 !landing right 520 DATA 0018180C0A181018,181808081C0A0818 540 FOR CHRR=33 TO 38 !setup for creating running characters right 560 READ PAT$ 580 CALL CHAR(CHRR,PAT$) 600 NEXT CHRR 620 REM CHR=CHRR 640 FOR CHSR=39 TO 43 !setup for creating stop and jump characters right 660 READ PAT$ 680 CALL CHAR(CHSR,PAT$) 700 NEXT CHSR 720 FOR CHJR=64 TO 67 !setup for creating jumping characters right 740 READ PAT$ 760 CALL CHAR(CHJR,PAT$) 780 NEXT CHJR 800 FOR CHLR=68 TO 69 !setup for creating landing characters right 820 READ PAT$ 840 CALL CHAR(CHLR,PAT$) 860 NEXT CHLR 880 REM left running*********************** 900 FOR CHRL=70 TO 75 !setup for creating running characters left 920 READ PAT$ 940 CALL CHAR(CHRL,PAT$) 960 NEXT CHRL 980 FOR CHSL=76 TO 80 !setup for creating stop and jump characters left 1000 READ PAT$ 1020 CALL CHAR(CHSL,PAT$) 1040 NEXT CHSL 1060 FOR CHJL=81 TO 84 !setup for creating jumping characters left 1080 READ PAT$ 1100 CALL CHAR(CHJL,PAT$) 1120 NEXT CHJL 1140 FOR CHLL=85 TO 86 !setup for creating landing characters left 1160 READ PAT$ 1180 CALL CHAR(CHLL,PAT$) 1200 NEXT CHLL 1220 BGIR$="3C4426D999A5C3FF" !BAD girder for level HOLE creation 1240 GIR$="FFC3A59999A5C3FF" !GIRDER FOR LEVELS 1260 CALL CHAR(104,BGIR$,105,GIR$)!girder for level creation 1280 GRAV$="FFFFFFFFFFFFFFFF" :: CALL CHAR(106,GRAV$)!THE HOLE 1300 EXT$="1F1111111D11111F" :: CALL CHAR(107,EXT$)!THE EXIT 1320 HRT$="66FFFFFF7E7E3C18" :: CALL CHAR(88,HRT$)!THE HEART 1340 ZED$="3C2418FF9918183C" :: CALL CHAR(96,ZED$)!THE ZED 1360 MLE$="C0E0703A1E0C1A01" :: CALL CHAR(112,MLE$)!MELEE 1380 RNG$="000000FF7F1E1606" :: CALL CHAR(113,RNG$)!RANGED WEAPONS 1400 SCTXT1$="70808063141414E3" :: SCTXT2$="00000000334A4A32" :: SCTXT3$="00000000993C2118" !Word Score 1420 CALL CHAR(120,SCTXT1$):: CALL CHAR(121,SCTXT2$):: CALL CHAR(122,SCTXT3$) 1440 EXTXT$="0044442810284444" :: CALL CHAR(123,EXTXT$)! the letter X remain for GUI 1460 LVLTXT$="E0E080E9EF86EFE9" :: CALL CHAR(124,LVLTXT$)! EX TEXT IN GUI 1480 IDLE$="3838107CBA38286C" :: CALL CHAR(44,IDLE$)!***IDLE MAN 1500 MMELE$="3C3C18FF7E3C183C" :: MRNGL$="0C0C04FC4C3C286C" :: MRNGR$="3030203F323C1436" ! MELEE & l/r RANGED ATTACKS 1520 MWA$="002418FF1824" :: BULET$="0000008" !WEAPONS FIRE 1540 ZDI$="3C2418FF9918183C" :: ZDA$="3CA5DB7E1818183C" :: ZWL1$="3C2C18F81838246C" :: ZWL2$="3C2C18F818181838" !ZED IDLE&WALK LEFT 1560 ZWR1$="3C34181F181C2436" :: ZWR2$="3C34181F1818181C" !ZED WALK RIGHT 1580 CALL CHAR(45,MMELE$,46,MRNGL$,47,MRNGR$)!MAN ATTTACKS 1600 CALL CHAR(143,MWA$,142,BULET$)!WEAPONS FIRE 1620 RANDOMIZE 1640 SLOT=10 !STARTING SPRITE NUMBER FOR LOOT and more 1660 OPTION BASE 1 1680 DIM LO0T(2,14)!LOOT DISTRIBUTION AND COLLISION. 1700 LTN=1 !LOOT ARRAY COORDS COL 1720 LAB=1 !LOOT ARRAY COORDS ROW 1740 SHL=2 :: GRND=17 !START ground level on top girder (YP+8pixels), LEVEL AND SPRITE HOLE # 1760 LVL=3 :: YP=9 :: XP=8 :: RS=0 :: CS=16 :: RSPD=2 !start pos,vel,controller run speed multiplier rspd 1780 ZHELTH=2 !default health of zombies start of game 1800 GOSUB 4500 !*******************************Create Level 1820 REM***************************************Create Sprite Idle******** 1840 CALL SPRITE(#1,44,6,YP,XP) 1860 CALL JOYST(1,JX,JY):: !check for joystick input 1880 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 1900 ELSE 1920 1900 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 1920 IF JY=0 THEN 1960 ELSE 1940 1940 GOSUB 7200 1960 CALL COINC(ALL,C):: IF C=0 THEN 2000 ELSE 1980 !collision check 1980 GOSUB 4940 !collision actions 2000 GOSUB 6160 !*************WALL COLLISION CHECK 2020 IF K<>18 AND K<>74 AND K<>106 THEN 3360 !no kb pressed check for joyst 2040 REM ********jump routine check******** 2060 CALL MOTION(#1,0,0) 2080 IF CS<>-16 THEN 2160 2100 CALL POSITION(#1,YP,XP)!get new position for next sprite 2120 GOSUB 2240 ! goto jump left 2140 GOTO 1820 2160 IF CS<>16 THEN 3360 2180 CALL POSITION(#1,YP,XP)!get new position for next sprite 2200 GOSUB 2800 !goto jump right************************** 2220 GOTO 1820 2240 REM *************jump left routine********* 2260 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! 2280 CALL SPRITE(#1,CHSL,6,YP,XP)!recreate sprite1 as stop and jump characters 2300 FOR PT=76 TO 80 !setup stop and jump animation left 2320 CALL PATTERN(#1,PT)!ANIMATE 2340 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2360 NEXT DELAY 2380 NEXT PT !continue animating the stop and jump until done 2400 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping 2420 IF XP<=24 THEN 2620 2440 CS=-20 :: YP=YP-3 :: RS=0 :: CALL SPRITE(#1,CHJL,6,YP,XP,RS,CS)!jumping left 2460 FOR PT=81 TO 84 2480 CALL PATTERN(#1,PT) 2500 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2520 NEXT DELAY 2540 NEXT PT 2560 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 2580 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 2600 YP=YP+3 !RESET YP TO BE GROUND. 2620 CALL SPRITE(#1,CHLL,6,YP,XP) 2640 FOR PT=85 TO 86 !setup landing animation left 2660 CALL PATTERN(#1,PT) 2680 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2700 NEXT DELAY 2720 NEXT PT ! continue landing animation until last frame 2740 CALL POSITION(#1,YP,XP)!get new position for next sprite 2760 CS=-16 2780 RETURN 2800 REM *************jump right routine****** 2820 CS=0 :: CALL MOTION(#1,0,CS)!joystick button pressed so STOP running! right 2840 CALL SPRITE(#1,CHSR,6,YP,XP)!recreate sprite1 as stop and jump characters right 2860 FOR PT=39 TO 43 !setup stop and jump animation right 2880 CALL PATTERN(#1,PT) 2900 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 2920 NEXT DELAY 2940 NEXT PT !continue animating the stop and jump until done right 2960 CALL POSITION(#1,YP,XP)!get new postion for animating the jumping right 2980 IF XP>=224 THEN 3180 3000 CS=20 :: YP=YP-3 :: CALL SPRITE(#1,CHJR,6,YP,XP,RS,CS)!jumping right 3020 FOR PT=64 TO 67 !setup jumping characters right 3040 CALL PATTERN(#1,PT) 3060 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 3080 NEXT DELAY 3100 NEXT PT 3120 CS=0 :: CALL MOTION(#1,0,CS)!stop motion at end of jumping animation to begin landing animation. 3140 CALL POSITION(#1,YP,XP)!get new position for starting landing animation. 3160 YP=YP+3 3180 CALL SPRITE(#1,CHLR,6,YP,XP) 3200 FOR PT=68 TO 69 !setup landing animation 3220 CALL PATTERN(#1,PT) 3240 FOR DELAY=1 TO 6 !these delays adjusts animation frame rate to match desired rate. 3260 NEXT DELAY 3280 NEXT PT ! continue landing animation until last frame 3300 CALL POSITION(#1,YP,XP)!get new position for next sprite 3320 CS=16 3340 RETURN 3360 REM **************Check Joyst Options************ 3380 IF JX<>0 THEN 3440 3400 CALL MOTION(#1,0,0) 3420 GOTO 1860 3440 REM ********running check*************** 3460 IF JX<>-4 THEN 3520 3480 CALL POSITION(#1,YP,XP)!get new position for next sprite 3500 GOSUB 4040 3520 IF JX<>4 THEN 1860 3540 CALL POSITION(#1,YP,XP)!get new position for next sprite 3560 GOSUB 3600 3580 GOTO 1860 !after RETURN goto joyst check 3600 REM ************run right routine******** 3620 CS=16 :: CALL SPRITE(#1,CHRR,6,YP,XP)!create the runner and send running 3640 CALL MOTION(#1,0,JX*RSPD) 3660 FOR PT=33 TO 38 STEP 2 !setup for animating the run right 3680 CALL PATTERN(#1,PT) 3700 CALL JOYST(1,JX,JY):: !check for joystick input 3720 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 3740 ELSE 3760 3740 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 3760 CALL COINC(ALL,C):: IF C=0 THEN 3800 ELSE 3780 !collision check 3780 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 4940 !collision actions 3800 GOSUB 6160 !*************WALL COLLISION CHECK 3820 IF JY=0 THEN 3860 ELSE 3840 3840 GOSUB 7200 3860 IF JX<>0 THEN 3900 ELSE 3880 !not joy pressed keep running 3880 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 3900 IF JX=4 THEN 3940 3920 IF JX=-4 THEN 4020 3940 CALL MOTION(#1,0,JX*RSPD) 3960 NEXT PT 3980 IF JX=4 THEN 3660 4000 CALL POSITION(#1,YP,XP)!check position and store before stopping motion 4020 RETURN 4040 REM **********run left routine************** 4060 CS=-16 :: CALL SPRITE(#1,CHRL,6,YP,XP)!create the runner and send running 4080 CALL MOTION(#1,0,JX*RSPD) 4100 FOR PT=70 TO 75 STEP 2 !setup for animating the run left 4120 CALL PATTERN(#1,PT) 4140 CALL JOYST(1,JX,JY)!check for joystick input 4160 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 4180 ELSE 4200 4180 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 4200 CALL COINC(ALL,C):: IF C=0 THEN 4240 ELSE 4220 !collision check 4220 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP):: GOSUB 4940 !collision actions 4240 IF xp<=23 OR XP>=230 THEN 4250 ELSE 4260 4250 GOSUB 6160 !*************WALL COLLISION CHECK 4260 IF JY=0 THEN 4300 ELSE 4280 4280 GOSUB 7200 4300 IF JX<>0 THEN 4340 ELSE 4320 !not joy pressed keep running 4320 CALL POSITION(#1,YP,XP):: CALL MOTION(#1,0,0):: CALL SPRITE(#1,44,6,YP,XP):: RETURN 4340 CALL JOYST(1,JX,JY) 4360 IF JX=-4 THEN 4400 4380 IF JX=4 THEN 4480 4400 CALL MOTION(#1,0,JX*RSPD) 4420 NEXT PT 4440 IF JX=-4 THEN 4100 4460 CALL POSITION(#1,YP,XP)!check position and store for next sprite 4480 RETURN 4500 REM *************************************************************************level creation************************ 4520 GOSUB 6360 !*************************gui creation****** 4540 HLE=INT((RND*15)+5) 4560 FOR LVL=1 TO 8 4580 IF LVL=1 THEN 4620 4600 GOSUB 5620 !*************************************GOSUB********LOOT********** 4620 CALL VCHAR(1,1,105,24)!LEFT WALL 4640 CALL VCHAR(1,32,105,24)!RIGHT WALL 4660 CALL HCHAR(LVL*3,1,105,HLE-1)!LEFT SIDE GIRDERS 4680 IF LEVEL=8 THEN 4700::CALL SPRITE(#SHL,106,1,GRND-3,(HLE*+1)!HOLE PROPER 4690 SHL=SHL+1 !ADVANCE SPRITE # 4700 CALL HCHAR(LVL*3,HLE+3,105,32-(HLE+3))!RIGHT SIDE Girders 4720 CALL HCHAR(LVL*3,HLE,104)!CRUMBLE LEFT SIDE 4740 CALL HCHAR(LVL*3,HLE+2,104)!crumble right side 4760 GRND=GRND+24 4780 HOL=INT((RND*15)+5)!NEW LOCATION FOR HOLE 4800 IF HOL=HLE THEN 4780 !NOT EQUAL TO PREVIOUS HOLE 4820 HLE=HOL !SET PROPER HOLE VARIABLE 4860 NEXT LVL !GO CREATE NEXT LEVEL 4880 CALL SPRITE(#9,107,15,22*8,30*! THE EXIT 4900 CALL HCHAR(24,1,105,31)!THE FLOOR 4920 RETURN 4940 REM *****************************************************************collision action******* 4960 CALL COINC(#1,#9,4,C):: IF C<>0 THEN 5580 ELSE 4980 !****collision check against exit 4980 FOR DET=2 TO 8 !there are 7 holes to check against. 5000 CALL COINC(#1,#DET,6,C)!**************************collision check against holes 5020 IF C<>0 THEN 5540 ELSE 5040 5040 NEXT DET 5060 FOR DET=10 TO 23 !************************collision check against LOOT********************* 5080 CALL COINC(#1,#DET,6,C) 5100 IF C=0 THEN 5120 ELSE 5130 5120 NEXT DET 5125 RETURN 5130 TLOOP1=DET-9 5180 IF LO0T(1,TLOOP1)<>88 THEN 5260 !heart 5200 SCORE=SCORE+8 :: IF HEALTH<10 THEN HEALTH=HEALTH+1 5220 GOSUB 6360 !*************************gui UPDATE****** 5240 GOTO 5480 5260 IF LO0T(1,TLOOP1)<>96 THEN 5340 !******ZED*********** 5280 CALL SOUND(100,-4,0,110,0,1000,0)::HEALTH=HEALTH-1 :: IF HEALTH<=0 THEN 6480 5300 GOSUB 6360 !*************************gui UPDATE****** 5320 RETURN 5340 IF LO0T(1,TLOOP1)<>112 THEN 5420 !melee 5360 SCORE=SCORE+3 :: IF MELEE<10 THEN MELEE=MELEE+1 5380 GOSUB 6360 !*************************gui UPDATE****** 5400 GOTO 5480 5420 IF LO0T(1,TLOOP1)<>113 THEN 5480 !ranged 5440 SCORE=SCORE+5 :: IF MELEE<10 THEN RANGED=RANGED+1 5460 GOSUB 6360 !*************************gui UPDATE****** 5480 CALL DELSPRITE(#DET)::GOTO 5560 5520 GOTO 5560 5540 FOR FALL=1 TO 24 :: YP=YP+1 :: CALL SPRITE(#1,44,6,YP,XP):: NEXT FALL !*****FALL********** 5560 RETURN 5580 REM *****************************************************BOARD**Progression************ 5600 CALL DELSPRITE(ALL):: BOARD=BOARD+1 :: RESTORE 240::IF SCORE>HSCORE THEN HSCORE=SCORE::GOTO 140 5620 REM ***********************************************************LOOT DISTRIBUTION SYSTEM****** 5640 SWITCH=INT(RND*2)+1 5660 FOR LT=1 TO 2 5680 LOOT=INT(RND*4)+1 5700 IF SWITCH=1 THEN 5720 ELSE 5740 5720 SWITCH=-5 :: GOTO 5800 5740 IF SWITCH=2 THEN 5760 ELSE 5780 5760 SWITCH=5 :: GOTO 5740 5780 IF SWITCH=5 THEN SWITCH=-5 ELSE SWITCH=5 5800 IF LOOT<>1 THEN 5880 5820 CALL SPRITE(#SLOT,88,7,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !HEART LOOT 5840 LO0T(LAB,LTN)=88 :: LAB=LAB+1 5860 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 5880 IF LOOT<>2 THEN 5960 5900 CALL SPRITE(#SLOT,96,4,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !ZED 5920 LO0T(LAB,LTN)=96 :: LAB=LAB+1 5940 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 5960 IF LOOT<>3 THEN 6040 5980 CALL SPRITE(#SLOT,112,8,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !MELEE 6000 LO0T(LAB,LTN)=112 :: LAB=LAB+1 6020 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 6040 IF LOOT<>4 THEN 6120 6060 CALL SPRITE(#SLOT,113,14,GRND-9,((HLE+1)*+SWITCH*:: SLOT=SLOT+1 !RANGED 6080 LO0T(LAB,LTN)=113 :: LAB=LAB+1 6100 LO0T(LAB,LTN)=SLOT-1 :: LAB=1 :: LTN=LTN+1 6120 NEXT LT 6140 RETURN 6160 REM **********cOLLISION cHECK WALLs 6180 CALL COINC(#1,YP,4,8,C):: IF C<>0 THEN 6220 ELSE 6280 6220 CALL LOCATE(#1,YP,13):: CALL MOTION(#1,0,0) 6240 CALL JOYST(1,JX,JY):: IF JX=-4 THEN 6220 ELSE RETURN 6260 IF XP>=230 THEN 6280 ELSE 6340 6280 CALL COINC(#1,YP,247,8,C):: IF C<>0 THEN 6300 ELSE 6340 6300 CALL LOCATE(#1,YP,239):: CALL MOTION(#1,0,0) 6320 CALL JOYST(1,JX,JY):: IF JX=4 THEN 6300 ELSE RETURN 6340 RETURN 6360 REM ********************GUI*********** 6380 DISPLAY AT(1,4):SCORE :: DISPLAY AT(1,11):BOARD :: DISPLAY AT(1,16):HEALTH :: DISPLAY AT(1,22):MELEE :: DISPLAY AT(1,27):RANGED !Output GUI 6400 CALL VCHAR(1,4,120):: CALL VCHAR(1,5,121):: CALL VCHAR(1,6,122)!score text gui 6420 CALL VCHAR(1,13,123):: CALL VCHAR(1,18,123):: CALL VCHAR(1,24,123):: CALL VCHAR(1,29,123)!Xs gui 6440 CALL VCHAR(1,12,124):: CALL VCHAR(1,17,88):: CALL VCHAR(1,23,112):: CALL VCHAR(1,28,113)!BOARD,hearts,melee,ranged gui 6460 RETURN 6480 REM ******************************YOU ARE DEAD*********************** 6500 CALL MOTION(#1,0,0):: CALL DELSPRITE(ALL):: CALL SCREEN(10) 6520 DATA 89,0044442810101010,79,007C44444444447C,85,0044444444444438 6540 DATA 65,003844447C444444,82,0078444478504844,69,007C40407840407C 6560 DATA 68,0078242424242478 6580 FOR YAD=1 TO 7 6600 READ YADC,YADP$ 6620 CALL CHAR(YADC,YADP$) 6640 NEXT YAD 6660 CALL CLEAR 6680 CALL VCHAR(12,10,89):: CALL VCHAR(12,11,79):: CALL VCHAR(12,12,85):: CALL VCHAR(12,13,32)!YOU 6700 CALL VCHAR(12,14,65):: CALL VCHAR(12,15,82):: CALL VCHAR(12,16,69):: CALL VCHAR(12,17,32)!ARE 6720 CALL VCHAR(12,18,68):: CALL VCHAR(12,19,69):: CALL VCHAR(12,20,65):: CALL VCHAR(12,21,68)!DEAD 6740 FOR CLRS=1 TO 13 :: CALL COLOR(CLRS,16,1):: NEXT CLRS 6760 CALL SCREEN(2) 6780 GOSUB 6360 6800 CALL KEY(1,K,S):: IF K=0 AND S=-1 THEN 7400 :: IF K=6 THEN 6820 ELSE 6840 6820 CALL DELSPRITE(ALL):: RESTORE 240 :: GOTO 100 6840 CALL JOYST(1,JX,JY):: IF JX=0 THEN 6800 :: IF JY=0 THEN 6800 ELSE 6820 6860 REM*******************MAN MELEE ATTACK 6880 CALL PATTERN(#1,45)!melee attack pattern 6900 CALL SPRITE(#24,143,12,YP,XP+:: CALL SOUND(125,-5,0)!right attack 6920 GOSUB 7460 6940 CALL DELSPRITE(#24) 6960 CALL SPRITE(#25,143,12,YP,XP-:: CALL SOUND(125,-6,0)!left attack 6980 GOSUB 7560 7000 CALL DELSPRITE(#25) 7020 CALL PATTERN(#1,44):: RETURN 7040 REM ******************MAN RANGED ATTACK 7060 CALL SOUND(100,-6,0):: RETURN 7080 !IF KSLOT=1 THEN 7090::RETURN 7100 !KSLOT=0::SLOT=SLOT-1::RETURN 7120 REM*****************ZED COLLISION BEHAVIOR************* 7140 RETURN 7160 REM****************ZED ATTACK****************** 7180 RETURN 7200 REM *****JOYS Combat choice***** 7220 IF MELEE>=1 THEN 7260 ELSE 7240 7240 CALL SOUND(100,-3,0):: RETURN 7260 CALL MOTION(#1,0,0):: CALL POSITION(#1,YP,XP) 7280 IF JY=4 THEN 7300 ELSE 7340 7300 MELEE=MELEE-1 :: GOSUB 6360 !*******UPDATE GUI 7320 GOSUB 6860 :: RETURN 7340 IF JY=-4 THEN 7360 ELSE 7380 7360 GOSUB 7060 7380 RETURN 7400 REM***quit game 7420 CALL CLEAR 7440 END 7460 FOR DET=10 TO 23 !************************mELEE collision check against LOOT********************* 7480 CALL COINC(#24,#DET,7,C) 7500 IF C<>0 THEN 7640 ELSE 7520 7520 NEXT DET 7540 RETURN 7560 FOR DET=10 TO 23 7580 CALL COINC(#25,#DET,7,C) 7600 IF C<>0 THEN 7640 ELSE 7620 7620 NEXT DET :: RETURN 7640 TLOOP1=DET-9 7660 IF LO0T(1,TLOOP1)<>88 THEN 7680 ELSE 7840 !heart 7680 IF LO0T(1,TLOOP1)<>96 THEN 7780 !zed - ALL ALPHA TEMP CODE 7700 ZHELTH=ZHELTH-1 :: IF ZHELTH>=1 THEN 7860 7720 SCORE=SCORE+10 :: ZHELTH=2 7740 GOSUB 6360 !*************************gui UPDATE****** 7760 GOTO 7840 7780 IF LO0T(1,TLOOP1)<>112 THEN 7820 !melee 7800 GOTO 7840 7820 IF LO0T(1,TLOOP1)<>113 THEN 7860 !ranged 7840 CALL DELSPRITE(#DET):: RETURN 7860 RETURN Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 20, 2016 Share Posted August 20, 2016 (edited) This is very nice. I will update this code below to the latest version when ever ... I would like new posts with perhaps only the essentials, instead of one big post with an ever increasing log. Yes, add TIFILES file, so I don't have to cut, paste and wait. Joystick down = ranged attack temporarily using a noise for place holder. If I have no swords, theres no noise for ranged attack. Sometimes I can run through objects, without it registering. Sometimes I get a new game screen without any zombies. I'm not sure how you do the collision detection, but here's what I'm thinking ... Only the player moves, so he could be the only sprite on board. All the objects could be background graphics. The holes already are. The player is of course always on one and only one floor at a time. So there is 3 objects (or less) to check for. Lets say you have a multidimensional array like 100 DIM LEVEL(8,3,2) First parameter being the Floor no. (1-8 ). Second being Object no. (1-3). Third, 1 for object Type (-1=Object not in use, 0=Hole, 1=Zombie, 2=Door, 3=Heart etc.). Third, 2 for object Position on that floor. Examples: LEVEL(1,1,1) sets/gets object type from first floor, first object. LEVEL(5,2,2) sets/gets object position from fifth floor, second object. Your collision detection would then, at all times be going through 3 objects. The Floor variable is only changed when you drop through a hole. Calculating the player sprite's character position (which you must already do) is only done once, before looping the objects on that floor, FOR O=1 TO 3. If object is not in use, you simply skip to NEXT O. Edited August 20, 2016 by sometimes99er Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 20, 2016 Author Share Posted August 20, 2016 ..... Thanks for all this. I think today i'm going to avoid putting it off and redo the collisions finally. You say you've had some missed collisions, I haven't had any, so if what I'm seeing isn't matching player experience, something needs to be done. The tricky part for me has been randomly generated loot. I am storing sprite # and CHAR code at time of creation then I was running coinc against all 14 possible sprite IDs on the level then checking the char code to identify the sprite type. After some adjustments I mad over the past few versions, AND reading your post, A light went off. Due to the method I am generating the levels and distributing the loot, I already have everything I need to run only ONE coinc for the collision detection. Let me explain. And I was heading in this direction slowly, I'm just trying to cram all the core mechanics in before hand (alpha version). But after you posted this I decided to strike while the iron is hot. Sprite#1 gets assigned to the player character. Sprite number 2-8 get assigned on the fly to each hole SHL=2, shl=shl+1 for each level a hole gets created (7 total) Exit = sprite #9 Loot = Sprite numbers 10-23 (14 loot items on every board) and the numbers get assigned at time of random selection and creation (chosen randomly 1 of 4). Then, due to the nature of my level creation for next loops and loot creation for next loops, I first place a loot item to the left of hole on level 2 and then put a loot item on the right of hole on level 2, then drop a level and do the same. So, because of all the maths. I already know what sprite number gets put in what exact location. What kind of loot item it is (at time of creation, I just need to store a value for this in my existing array). I don't want to run a collision check all the time. I only want to run it when needed (see my wall collision check section). Like what I do for wall collision checks. 4240 IF xp<=23 OR XP>=230 THEN 4250 ELSE 4260 4250 GOSUB 6160 !*************WALL COLLISION CHECK 6160 REM **********cOLLISION cHECK WALLs 6180 CALL COINC(#1,YP,4,8,C):: IF C<>0 THEN 6220 ELSE 6280 6220 CALL LOCATE(#1,YP,13):: CALL MOTION(#1,0,0) 6240 CALL JOYST(1,JX,JY):: IF JX=-4 THEN 6220 ELSE RETURN 6260 IF XP>=230 THEN 6280 ELSE 6340 6280 CALL COINC(#1,YP,247,8,C):: IF C<>0 THEN 6300 ELSE 6340 6300 CALL LOCATE(#1,YP,239):: CALL MOTION(#1,0,0) 6320 CALL JOYST(1,JX,JY):: IF JX=4 THEN 6300 ELSE RETURN 6340 RETURN So I don't do wall collision checks at all unless the player is in proximity of a wall. I'd like to do the same for all loot items. ***The only time any of this would need a different method is with Zombies. Well, because I want them to move. So their exact location is not known but their vicinity is. For example Level 5 right side of hole dot column number there is a zombie so start coinc'ing for it. As for moving/chasing/leaping zombies (coming in harder levels) I would use a distance call between player and all free roaming zeds. start doing coincs when distance is close enough. That's my current thought process. Due to your post I am now motivated to work on this NOW. You have given me the push I need and some great ideas for reducing the amount of COINC calls I make AND combined with what I'm doing, decrease it even further. (I don't have to do 3COINC checks *ALL* the time) Side Note: One of the best communities right here. Thanks again sometimes99er. 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 20, 2016 Author Share Posted August 20, 2016 Oh and BTW - "Sometimes I get a new game screen without any zombies."Yes, this is deliberate. anyone of 4 loots can spawn with no guarantee anything in particular will spawn. I'm OK with this in the beginning levels at the alpha stage but the back end control will be rewritten so I can guarantee at least one of each loot items and adjust the chances of a spawn on each so I can control loot spawn difficulty with board progressions. (more zombies less heals/weapons in higher levels) 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 20, 2016 Share Posted August 20, 2016 You say you've had some missed collisions, I haven't had any, so if what I'm seeing isn't matching player experience, something needs to be done. Well, it did take long to get it to miss again. 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 20, 2016 Author Share Posted August 20, 2016 Well, it did take long to get it to miss again. I never doubted you. But it hurts to see it. 1 Quote Link to comment Share on other sites More sharing options...
sometimes99er Posted August 20, 2016 Share Posted August 20, 2016 Due to your post I am now motivated to work on this NOW. You have given me the push I need and some great ideas for ... Excellent. I never doubted you. But it hurts to see it. Hope it doesn't discourage you. Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 20, 2016 Author Share Posted August 20, 2016 Hope it doesn't discourage you. Nope, just motivates me to fix it. 1 Quote Link to comment Share on other sites More sharing options...
Sinphaltimus Posted August 20, 2016 Author Share Posted August 20, 2016 And of course I got a little side tracked - v030 spoiler alert! V030 changes: Can jump while running. 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.