Sorry, an error occurred while loading the content.

## Sprite Problem

Expand Messages
• The code work Fine until you press the left or right key which makes you move 5 pickles in that direction. Then when you press k to shoot the smiley move side
Message 1 of 3 , Dec 1, 2005
• 0 Attachment
The code work Fine until you press the left or right key which makes
you move 5 pickles in that direction. Then when you press k to shoot
the smiley move side ways either left or right depending on which
key you pressed last. I do not know why it does this can anyone help?

Thank you

If you want to run the code you will need the pictures

nomainwin
WindowWidth = 500
WindowHeight = 500
statictext #main.1, "", 5, 5, 100, 20
statictext #main.2, "", 30, 5, 100, 20
open "Smily wars" for graphics_nsb as #main
x1=33:x2=287
y1=12:y2=311
print #main, "addsprite SpriteName bmp1";
print #main, "addsprite missile bmp2";
print #main, "spritexy SpriteName 50 50";
print #main, "spritexy missile 100 100"
print #main, "centersprite SpriteName";
print #main, "centersprite missile";
print #main, "drawsprites";
[loop]
print #main, "spritexy? SpriteName shipx shipy"
if shipx<0 then shipx=0
if shipx>470 then shipx=470
if shipy<15 then shipy=15
if shipy>450 then shipy=450
print #main, "spritexy SpriteName ";shipx;" ";shipy
print #main, "spritexy? SpriteName shipx shipy"
#main.1 shipx
#main "setfocus; when characterInput [check]"

wait
[check]
char\$ = Inkey\$

c\$ = Inkey\$
if asc(right\$(c\$,1))=_VK_LEFT then [left]
if asc(right\$(c\$,1))=_VK_RIGHT then [right]
if c\$="k" then [shoot]
wait

[left]
print #main, "spritemovexy SpriteName -5 0";
print #main, "drawsprites";
goto [loop]
wait
[right]
print #main, "spritemovexy SpriteName 5 0";
print #main, "drawsprites";
goto [loop]
wait
[down]
print #main, "spritemovexy SpriteName 0 5";
print #main, "drawsprites";
goto [loop]
wait
[up]
print #main, "spritemovexy SpriteName 0 -5";
print #main, "drawsprites";
goto [loop]
wait
[shoot]
print #main, "spritexy? SpriteName missileX missileY"
print #main, "spritexy missile ";missileX;" ";missileY
[shootloop]
let missileY =missileY+10
if missileY = 470 then goto [loop]
print #main, "spritexy missile ";missileX;" ";missileY
print #main, "drawsprites";
goto [shootloop]
wait
• Dear Alex, Your problem is that you think that print #main, spritemovexy SpriteName 0 -5 ; only will be executed ONCE. But in fact, it is executed EACH time
Message 2 of 3 , Dec 1, 2005
• 0 Attachment
Dear Alex,

Your problem is that you think that

print #main, "spritemovexy SpriteName 0 -5";

only will be executed ONCE.
But in fact, it is executed EACH time you
give a

print #main, "drawsprites";

A possible solution can be to change your

print #main, "spritemovexy SpriteName 0 -5";
print #main, "drawsprites";

into

print #main, "spritemovexy SpriteName 0 -5";
print #main, "drawsprites";
print #main, "spritemovexy SpriteName 0 0";

Do this for all four moves!!!

Hth

Stefan Hesseling
• The code work Fine until you press the left or right key which makes you move 5 pickles in that direction It s cool about the pickles. Never knew LB could be
Message 3 of 3 , Dec 1, 2005
• 0 Attachment
"The code work Fine until you press the left or right key which makes
you move 5 pickles in that direction"
It's cool about the pickles. Never knew LB could be a Veggie program. :)
Yes, I know you meant pixels.

alexbarfoot <alexbarfoot@...> wrote:
The code work Fine until you press the left or right key which makes
you move 5 pickles in that direction. Then when you press k to shoot
the smiley move side ways either left or right depending on which
key you pressed last. I do not know why it does this can anyone help?

Thank you

If you want to run the code you will need the pictures

nomainwin
WindowWidth = 500
WindowHeight = 500
statictext #main.1, "", 5, 5, 100, 20
statictext #main.2, "", 30, 5, 100, 20
open "Smily wars" for graphics_nsb as #main
x1=33:x2=287
y1=12:y2=311
print #main, "addsprite SpriteName bmp1";
print #main, "addsprite missile bmp2";
print #main, "spritexy SpriteName 50 50";
print #main, "spritexy missile 100 100"
print #main, "centersprite SpriteName";
print #main, "centersprite missile";
print #main, "drawsprites";
[loop]
print #main, "spritexy? SpriteName shipx shipy"
if shipx<0 then shipx=0
if shipx>470 then shipx=470
if shipy<15 then shipy=15
if shipy>450 then shipy=450
print #main, "spritexy SpriteName ";shipx;" ";shipy
print #main, "spritexy? SpriteName shipx shipy"
#main.1 shipx
#main "setfocus; when characterInput [check]"

wait
[check]
char\$ = Inkey\$

c\$ = Inkey\$
if asc(right\$(c\$,1))=_VK_LEFT then [left]
if asc(right\$(c\$,1))=_VK_RIGHT then [right]
if c\$="k" then [shoot]
wait

[left]
print #main, "spritemovexy SpriteName -5 0";
print #main, "drawsprites";
goto [loop]
wait
[right]
print #main, "spritemovexy SpriteName 5 0";
print #main, "drawsprites";
goto [loop]
wait
[down]
print #main, "spritemovexy SpriteName 0 5";
print #main, "drawsprites";
goto [loop]
wait
[up]
print #main, "spritemovexy SpriteName 0 -5";
print #main, "drawsprites";
goto [loop]
wait
[shoot]
print #main, "spritexy? SpriteName missileX missileY"
print #main, "spritexy missile ";missileX;" ";missileY
[shootloop]
let missileY =missileY+10
if missileY = 470 then goto [loop]
print #main, "spritexy missile ";missileX;" ";missileY
print #main, "drawsprites";
goto [shootloop]
wait

---------------------------------
Yahoo! Personals
Single? There's someone we'd like you to meet.
Lots of someones, actually. Yahoo! Personals

---------------------------------
Yahoo! Personals
Skip the bars and set-ups and start using Yahoo! Personals for free

[Non-text portions of this message have been removed]
Your message has been successfully submitted and would be delivered to recipients shortly.