Posted Sat Sep 18, 2010 5:45 AM
Posted Sat Sep 18, 2010 8:34 AM
if a = 0 then goto fire else nofire fire: if joy0fire then a = 1 nofire:
Posted Sat Sep 18, 2010 8:51 AM
yuppicide, on Sat Sep 18, 2010 8:34 AM, said:
Posted Sat Sep 18, 2010 9:24 AM
jubileebop, on Sat Sep 18, 2010 8:51 AM, said:
dim Time_Counter = a COLUBK = $C4 scorecolor = $1C Main_Loop Time_Counter = Time_Counter + 1 if Time_Counter < 60 then Skip_Timer Time_Counter = 0 score = score + 1 Skip_Timer drawscreen goto Main_Loop
Edited by Random Terrain, Sat Sep 18, 2010 9:25 AM.
Posted Sat Sep 18, 2010 10:33 AM
dim Frame_Counter = f COLUBK = $C4 scorecolor = $1C Main_Loop Frame_Counter = Frame_Counter + 1 if Frame_Counter < 60 then Skip_Timer score = score + 1 Frame_Counter = 0 Skip_Timer drawscreen goto Main_Loop
Posted Sat Sep 18, 2010 11:24 AM
Posted Sat Sep 18, 2010 12:01 PM
dim frames=a dim seconds=b dim minutes=c dim hours=d scorecolor=$0E loop if joy0fire then gosub reset_timer drawscreen frames=frames+1 if frames=60 then frames=0:seconds=seconds+1:score=score+1 if seconds=60 then seconds=0:minutes=minutes+1:score=score+40 if minutes=60 then minutes=0:hours=hours+1:score=score+4000 goto loop reset_timer frames=0:seconds=0:minutes=0:hours=0:score=0 returnTo make it PAL/50 compatible, add 'set tv pal' to it, and change the line after 'frames=frames+1' to 'if frames=50' instead of 'if frames=60'.
frames=frames+1:score=score+1 if frames=60 then frames=0:seconds=seconds+1:score=score+40 if seconds=60 then seconds=0:minutes=minutes+1:score=score+4000Again, you would change it to 'if frames=50' for a PAL/50 game.
dim minutes=score dim seconds=score+1 dim frames=score+2 scorecolor=$0E loop if joy0fire then gosub reset_timer drawscreen score=score+1 if frames=$60 then score=score+40 if seconds=$60 then score=score+4000 goto loop reset_timer score=0 returnI'm not certain what you mean by your other question, so I'll answer it two ways.
dim minutes=score dim seconds=score+1 dim frames=score+2 dim timer_running=a scorecolor=$0E loop if joy0fire then timer_running=timer_running^1 drawscreen if timer_running then score=score+1 if frames=$60 then score=score+40 if seconds=$60 then score=score+4000 goto loopThis isn't perfect, because you really need to debounce the fire button, otherwise it's almost impossible to press it just once.
Edited by SeaGtGruff, Sat Sep 18, 2010 12:04 PM.
Posted Sat Sep 18, 2010 12:44 PM
Posted Sat Sep 18, 2010 1:04 PM
Nukey Shay, on Sat Sep 18, 2010 12:44 PM, said:
Posted Sat Sep 18, 2010 2:58 PM
Posted Sat Sep 18, 2010 9:48 PM
set tv ntsc const ntsc=1 dim minutes=score dim seconds=score+1 dim frames=score+2 scorecolor=$0E loop if joy0fire then score=0 drawscreen score=score+2 if !ntsc then skip_ntsc temp1=frames&$0F if temp1=2 || temp1=7 then score=score-1 skip_ntsc if seconds=$60 then score=score+4000 goto loopFor PAL, just change the first two lines:
set tv pal const ntsc=0It goes ahead and adds 2 to score, since that will be the most likely addition. Then, if it's PAL (or not NTSC), it skips ahead to check the seconds. Otherwise (if it *is* NTSC) it checks the last digit of the already-incremented score. If the last digit is 2 or 7, it subtracts 1 from the score. So for NTSC the pattern for the hundredths of a second will be as follows:
Posted Sat Sep 18, 2010 10:14 PM
Posted Sun Sep 19, 2010 1:43 AM
includesfile timer.inc set tv ntsc const one_tenth=6 dim minutes=score dim seconds=score+1 dim tenths=score+2 dim frames=a scorecolor=$0E loop if joy0fire then score=0:frames=0 tenths=tenths|$A0 minutes=minutes|$0B drawscreen frames=frames+1:if frames<>one_tenth then skip_tenths frames=0 tenths=tenths&$0F minutes=minutes&$F0 score=score+1 if tenths=$10 then score=score+90 if seconds=$60 then score=score+94000 skip_tenths goto loopSince the score is a BCD number, and we want to use all the decimal digits (0 through 9), I defined "digit 10" ($A) to be a decimal point and "digit 11" ($B) to be a colon. If you want to set any of the score's digits to a non-BCD value (like $A or $B), you must directly set the appropriate byte of the score (e.g., tenths=$A0 or seconds=$0B). However, if you try to perform any math on the score while any of its digits contain a non-BCD value, the result will probably be garbled, or the new value probably won't be what you expected. So this example clears the colon and decimal from the score before doing any math on the score. Then the colon and decimal are restored to the score just before calling drawscreen.
Posted Sun Sep 19, 2010 1:50 AM
Nukey Shay, on Sat Sep 18, 2010 10:14 PM, said:
Posted Sun Sep 19, 2010 6:08 PM
Posted Sun Sep 19, 2010 9:27 PM
Posted Sun Sep 19, 2010 10:11 PM
SeaGtGruff, on Sun Sep 19, 2010 1:50 AM, said:
Posted Sun Sep 19, 2010 11:39 PM
Nukey Shay, on Sun Sep 19, 2010 10:11 PM, said:
SeaGtGruff, on Sun Sep 19, 2010 1:50 AM, said:
Posted Sat Sep 25, 2010 7:06 AM
Posted Sat Sep 25, 2010 12:44 PM
jubileebop, on Sat Sep 25, 2010 7:06 AM, said:
tenths=tenths|$A0 : rem * set the decimal point minutes=minutes|$0B : rem * set the colon drawscreen tenths=tenths&$0F : rem * clear the decimal point minutes=minutes&$F0 : rem * clear the colonIn the code snippet above, I removed some lines between "drawscreen" and where you clear the decimal point and colon, to help emphasize the placement of the statements relative to "drawscreen"-- but you need those other lines in there, so don't take them out.
jubileebop, on Sat Sep 25, 2010 7:06 AM, said:
0 members, 0 guests, 0 anonymous users