Jump to content
IGNORED

Firing in 2 directions?


Rabbit 2600

Recommended Posts

Sorry to be a bother, but I've hit a snag.

 

I'm using this code to to make player0 fire missile0 to the right:

checkfire
if missile0y>240 then goto skip
missile0y = missile0y -0 : missile0x = missile0x + 2 : goto draw
skip
if joy0right && joy0fire then missile0y=player0y-2:missile0x=player0x+4
draw

 

I'm wondering how I should go about to make the player fire to the left? I've tried everything I can come up with but I can't get it to work. At most when I'm using a counter I can make the player shoot to the left but when the player moves the shot goes in reverse.

 

 

Entire source:

rem Generated 2013-06-04 17:58:53 by Visual bB Version 1.0.0.554
rem **********************************
rem *<filename>					  *
rem *<description>				   *
rem *<author>					    *
rem *<contact info>				  *
rem *<license>					   *
rem **********************************
    set smartbranching on
AUDV0 = 0 : AUDV1 = 0

dim rand16 = z
 player0x = 50
 player0y = 50
player1x = rand
player1y = 0
c = c + 0
h = h + 10
k = 0
 missile0height = 2  : missile0y = 255
 NUSIZ0 = $00
 missile1height = 8 : missile1y = 255
 NUSIZ1 = $22
main
player1y = player1y + 1
NUSIZ1 = $77
COLUPF = $06
COLUBK = $D2
pfscroll down
 f=f+1
COLUP0 = $0E
COLUP1 = $0E
 if f = 10 then player0:
    %00000000
    %00000000
    %00010000
    %00010000
    %00011000
    %00110000
    %00010000
    %00101000
    %01010100
    %01000100
    %00010000
    %01010100
    %00111000
    %00010000
    %00000000
    %00000000
end
 if f = 20 then player0:
    %00000000
    %00000000
    %00010000
    %00010000
    %00110000
    %00011000
    %00010000
    %00101000
    %01010100
    %01000100
    %00010000
    %01010100
    %00111000
    %00010000
    %00000000
    %00000000
end
 if f=20 then f=0
    player1:
    %01101100
    %01101100
    %01010100
    %01111100
    %11111110
    %01111100
    %00111000
    %00010000
end

playfield:
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
............XXXXXXXX............
end
 if player1y = 90 then player1y = 0 : player1x = rand
 if joy0right then player0x = player0x + 1
 if joy0left then player0x = player0x - 1
 if joy0up then player0y = player0y - 1
 if joy0down then player0y = player0y + 1
if collision(player1,playfield) then player1y = 0 : player1x = rand
if collision(missile0,player1) then score = score +50 : missile0y = 255 : h = h + 11 : goto startsound
if joy0right && joy0fire then k = 1 : missile0y=player0y-2:missile0x=player0x+4
if joy0right && joy0fire then k = 2 : missile0y=player0y-2:missile0x=player0x+4

startsound
if h > 10 then AUDV0 = 15 : AUDC0 = 1 : AUDF0 = 6 : h = h - 1
nosound
if h < 11 then AUDV0 = 0 : AUDC0 = 0 : AUDF0 = 0
k = 1
 if missile0y>240 then goto skip
 missile0y = missile0y -0 : missile0x = missile0x + 2 : goto draw
skip
 if joy0right && joy0fire then missile0y=player0y-2:missile0x=player0x+4 : k = 0
draw


drawscreen

goto main

Edited by Rabbit 2600
Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...