Jump to content



0

Another glitch


1 reply to this topic

#1 gHan2000 OFFLINE  

gHan2000

    Space Invader

  • 41 posts

Posted Thu Feb 17, 2011 3:32 PM

This seems weird.

In one of my VbB games the missiles are shooting to the right side of the screen.

Code:

Quote

rem Generated 2/13/2011 6:17:27 PM by Visual bB Version 1.0.0.554
rem **********************************
rem *<filename> *
rem *<description> *
rem *<author> *
rem *<contact info> *
rem *<license> *
rem **********************************
playfield:
................................
................................
................................
................................
................................
................................
................................
................................
................................
................................
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
end

COLUBK = $7A
COLUPF = 84
player0x=50:player0y=50
player1x=20:player1y=20
missile0height=4:missile0y=255
NUSIZ0 = 16

sprites

player0:
100100
%10011001
%01111110
011000
111100
100100
100100
111100
end

player1:
000000
111100
%01111110
%01100110
%01100110
%01111110
111100
000000
end

if missile0x>240 then goto skip
missile0y=missile0y-2: goto draw_loop
skip
if joy0fire then missile0y = player0y-2:missile0y=player0x+4

draw_loop
drawscreen
goto sprites



Got any ideas?

I have been using gigafide's Youtube tutorial.

Edit: Ignore the indenting, the forum did that.

Edited by gHan2000, Thu Feb 17, 2011 3:33 PM.


#2 GroovyBee OFFLINE  

GroovyBee

    7800 Developer

  • 5,781 posts
  • Busy bee!
  • Location:North, England

Posted Thu Feb 17, 2011 3:58 PM

When you say "glitch" to me it means there is a bug in bB when in fact its in your code ;).

Please use the "code" tags and not the "quote" tags. It makes things much easier to read. To help people debug your code its better to attach your file instead.

Anyways...

View PostgHan2000, on Thu Feb 17, 2011 3:32 PM, said:

Quote

missile0height=4:missile0y=255

There aren't 255 pixels available in Y.

Quote

Quote

if joy0fire then missile0y = player0y-2:missile0y=player0x+4

You are initialising missile0y twice. The first time :-

missile0y = player0y-2

and then

missile0y=player0x+4

Maybe you meant to initialise its x co-ordinate instead?




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users