I've always said that writing a computer program is pretty easy if you know what you're doing. The question is, how easy can it be? I've written a version of Snakes and Ladders game in under 10 minutes. How quickly and easily can I write a sprite based game? Certainly, not too difficult.
I'm curious as to just how easy it is to write one. Certainly, there is the control. I settled for Up-Down-Fire, which is a variation of Left-Right-Fire. I was hoping for a single screen challenge program, and I managed to do it. However, it isn't fun at all. Also, it turns out that I don't need the Up-Down movement at all. Just sit there and hit the fire button!
- CLS:Y=0:A=256:C=128:S=0
- SPSET 1,96,0,0,0,0:T=3600
- SPSET 2,40,0,0,0,0
- SPOFS 2,-16,0,0:SPANIM 2,2,15
- SPSET 10,13,3,0,0,0
- @LOOP
- T=T-1:IF T<0 THEN END
- VSYNC 1:B=BUTTON(0):DX=0:DY=0
- LOCATE 0,0:?"S=";S,"T=";T;" "
- IF SPHIT(10) THEN S=S+1:BEEP
- IF !SPCHK(10) THEN GOSUB @MM
- IF (B AND 16) THEN GOSUB @FR
- IF !(B AND 3) GOTO @LOOP
- DY=(B AND 3)*2-3
- Y=Y+DY:IF Y<0 THEN Y=Y+192
- Y=Y%192:SPOFS 1,0,Y,0
- GOTO @LOOP
- @FR
- SPOFS 2,0,Y,0:SPOFS 2,A,Y,C/2
- RETURN
- @MM
- SPOFS 10,99+RND(99),-20,0
- SPOFS 10,99+RND(99),2*C,C
- RETURN
It's all very well and good for a single screen challenge, but I was curious as to how much better it would be, had it been a better fleshed out game. So, forget about the single screen challenge and just do better!
- CLS:Y=0:A=256:C=128:S=0
- BGFILL 0,0,0,63,63,9,8,0,0
- FOR I=1 TO 32
- BGPUT 0,RND(64),RND(64),32,8,0,0
- NEXT
- SPSET 1,96,0,0,0,0
- SPSET 2,40,0,0,0,0
- SPOFS 2,-16,0,0:SPANIM 2,2,15
- FOR I=10 TO 70
- SPSET I,13,3,0,0,0
- SPOFS I,99,-50,0
- NEXT
- @INIT
- BGMPLAY 23
- T=10800:S=0
- @LOOP
- IF HYC<S THEN HC=S
- IF !BGCHK(0) THEN BGOFS 0,RND(512),RND(512),360
- T=T-1:M=FLOOR(T/180):IF T<0 THEN GOTO @END
- VSYNC 1:B=BUTTON(0):DX=0:DY=0
- LOCATE 0,0:?"$=";S,"TIME=";M;" ","HI $=";HC;" "
- FOR I=10 TO 70-M
- IF SPHITSP(I,2) THEN S=S+1:BEEP 3:GOSUB @HIT
- IF !SPCHK(I) THEN GOSUB @MM
- NEXT
- IF (B AND 16) THEN GOSUB @FR
- IF !(B AND 3) GOTO @LOOP
- DY=(B AND 3)*2-3
- Y=Y+DY:IF Y<0 THEN Y=Y+192
- Y=Y%192:SPOFS 1,0,Y,0
- GOTO @LOOP
- @FR
- SPOFS 2,0,Y,0:SPOFS 2,A,Y,C/2
- RETURN
- @MM
- SPCHR I,13
- SPOFS I,99+RND(99),-20+256*RND(2),0
- SPOFS I,99+RND(99),-20+256*RND(2),99+RND(C)
- RETURN
- @HIT
- SPCHR I,248
- SPANIM I,8,6,1
- RETURN
- @END
- BGMPLAY 6
- WAIT 360
- FOR I=0 TO 16:I=BUTTON(0):NEXT
- GOTO @INIT
So far, I'm using standard graphics. It's very convenient that the graphics are all built-in. However, there is always a way to have custom made graphic. I won't list the source code, but check out the QR made for this game.
http://petitcomputer.wikia.com/wiki/Santa_Helper
No comments:
Post a Comment