Rabbit 2600 Posted September 24, 2013 Share Posted September 24, 2013 Trying to learn some neat tricks with missiles I figured they would make good swords so I managed to get something rudimentary going where you can swing your sword by pressing the fire button. But I can't make it reset again once it's been swung. Any ideas?SOURCE: Swordtest.bas CODE: rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288 player0x = 78 player0y = 80 player1x = 90 player1y = 80 missile0x = 84 missile0y = 75 a = 0 main COLUPF = $42 playfield: ................................ ................................ ................................ ................................ ................................ ................................ ................................ .............XXXXXX............. ...........XXXXXXXXXX........... ..........XXXXXXXXXXXX.......... .........XXXXXXXXXXXXXX......... end rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME... player0: %01101100 %01101100 %01101000 %00110000 %00110000 %00111000 %00100000 %00110000 %10110000 %11000000 end f=f+1 rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME... if f = 30 then player1: %00011100 %00011100 %00011100 %00001100 %00001100 %00011100 %00100100 %00101100 %00101101 %00000011 end if f = 60 then player1: %00110110 %00110110 %00011110 %00001100 %00001100 %11111100 %00000100 %00001100 %00001101 %00000011 end if f=60 then f=0 drawscreen if a = 0 then missile0height = 4 if a = 1 then NUSIZ0 = $20 : missile0height = 0 if joy0fire then a = 1 dim playerfacing = b if joy0right then playerfacing = 0 if joy0left then playerfacing = 8 REFP0 = playerfacing goto main Swordtest.bas Quote Link to comment Share on other sites More sharing options...
bomberpunk Posted September 24, 2013 Share Posted September 24, 2013 i know nothing about VCS coding, but if it's stuck just make the last sprite of animation blank to "clear" it if nothing else works. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 24, 2013 Share Posted September 24, 2013 See if this is what you want: swordtest_2013y_09m_24d_1326t.bas swordtest_2013y_09m_24d_1326t.bin Quote Link to comment Share on other sites More sharing options...
Rabbit 2600 Posted September 24, 2013 Author Share Posted September 24, 2013 Thank you, Random Terrain. That was exactly how I wanted the missile0 to behave. I really must learn to use dim's someday =) Quote Link to comment Share on other sites More sharing options...
Rabbit 2600 Posted September 24, 2013 Author Share Posted September 24, 2013 Hm, sorry to be a bother again, but I just can't get the repetition restrainer to work so you can't hold down the fire button. SOURCE : Swordtest2.bas Code: rem CODE INSPIRED BY Atarius Maximus at http://www.atariage.com/forums/index.php?showtopic=109288 set smartbranching on dim _Bit0_Player0_Sword = c dim _Bit1_Player1_Sword = c dim _Bit2_Player0_LR = c dim _P1_L_R = player1x.a dim _Bit1_FireB_Restrainer = e const pfscore=1 AUDV0=0 AUDV1=0 player0x = 78 player0y = 80 player1x = 255 player1y = 80 missile0x = 84 missile0y = 75 _Bit2_Player0_LR{2} = 1 pfscore1 = 21 __Main_Loop COLUPF = $42 COLUP0 = $00 COLUP1 = $00 scorecolor = $0E pfscorecolor = $0E playfield: ................................ ................................ ................................ ................................ ................................ ................................ ................................ .............XXXXXX............. ...........XXXXXXXXXX........... ..........XXXXXXXXXXXX.......... .........XXXXXXXXXXXXXX......... end rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME... player0: %01101100 %01101100 %01101000 %00110000 %00110000 %00111000 %00100000 %00110000 %10110000 %11000000 end f=f+1 rem POSSIBLY INEFFICIENT CODE, SEPARATE COLOR INFO FOR EACH FRAME... if f = 30 then player1: %00011100 %00011100 %00011100 %00001100 %00001100 %00011100 %00100100 %00101100 %00101101 %00000011 end if f = 60 then player1: %00110110 %00110110 %00011110 %00001100 %00001100 %11111100 %00000100 %00001100 %00001101 %00000011 end if f=60 then f=0 if !joy0fire then _Bit1_FireB_Restrainer{1} = 0 : goto __Skip_Fire if _Bit1_FireB_Restrainer{1} then goto __Skip_Fire _Bit1_FireB_Restrainer{1} = 1 _Bit0_Player0_Sword{0} = 0 if joy0fire then _Bit0_Player0_Sword{0} = 1 if !_Bit0_Player0_Sword{0} then missile0height = 4 if _Bit0_Player0_Sword{0} then NUSIZ0 = $20 : missile0height = 0 if joy0left then _Bit2_Player0_LR{2} = 0 if joy0right then _Bit2_Player0_LR{2} = 1 if _Bit2_Player0_LR{2} then goto __Skip_Left REFP0 = 8 if !_Bit0_Player0_Sword{0} then missile0x = player0x + 3 : missile0y = player0y - 5 if _Bit0_Player0_Sword{0} then missile0x = player0x : missile0y = player0y - 5 __Skip_Left if _Bit2_Player0_LR{2} then REFP0 = 0 : missile0x = player0x + 6 : missile0y = player0y - 5 __Skip_Fire drawscreen if collision(player0,player1) then pfscore1 = pfscore1/4 : player1x = 255 if collision(missile0,player1) && missile0height = 0 then n = 11 : player1x = 255 : score = score + 10 if player1x = 255 then d = (rand&1) if d = 0 then player1y = 80 : player1x = 140 : d = d + 2 if d = 1 then player1y = 80 : player1x = 10 : d = d + 2 if d = 2 then _P1_L_R = _P1_L_R - 0.37 : REFP1 = 0 if d = 3 then _P1_L_R = _P1_L_R + 0.37 : REFP1 = 8 if n > 0 then AUDV0 = 15 : AUDC0 = 7 : AUDF0 = 20 : n = n - 1: if n = 0 then AUDV0 = 0 goto __Main_Loop Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 25, 2013 Share Posted September 25, 2013 You had the code a little wrong. I also added a counter so the swing will hold for a certain amount of time. I chose half a second (30), but you can change it to whatever you want. swordtest2_2013y_09m_24d_1947t.bas swordtest2_2013y_09m_24d_1947t.bin Quote Link to comment Share on other sites More sharing options...
Rabbit 2600 Posted September 25, 2013 Author Share Posted September 25, 2013 (edited) Ahh, so that's how it was supposed to be! Cheers! That is great =) Edited September 25, 2013 by Rabbit 2600 Quote Link to comment Share on other sites More sharing options...
ultima Posted October 27, 2013 Share Posted October 27, 2013 death star break in had darth vader swinging a sword..could be useful for another example http://atariage.com/forums/topic/90213-deathstar-break-in/ 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.