Jump to content



0

Why not move the player in the game I'm doing?


4 replies to this topic

#1 JorgeLiborinho OFFLINE  

JorgeLiborinho

    Space Invader

  • 17 posts
  • Location:Americana SP, Brazil

Posted Wed Feb 9, 2011 1:26 PM

Uest And doing a simple game, and wrote these following codes:

set kernel_options player1colors

x=50
y=50

main

COLUBK= 2

player1:
%01101100
101000
111000
%10111010
%11111110
111000
111000
111000
end

player1color:
$00
$F4
$F4
$88
$98
$F6
$F6
$F6
end

player1x=50
player1y=50

drawscreen

if joy1right then x=x+1
if joy1left then x=x-1
if joy1up then y=y-1
if joy1down then y=y+1

goto main

I did everything right and do not know why the player does not move!
Hope someone helps!

#2 grafixbmp OFFLINE  

grafixbmp

    Dragonstomper

  • 659 posts
  • Location:South Central US

Posted Wed Feb 9, 2011 1:33 PM

Every time your loop cycles, the x and y of your player never change because thoes should be set outside of your loop.

#3 yuppicide OFFLINE  

yuppicide

    I am the Black Knight. Give me your money!

  • 6,933 posts
  • Location:New Jersey

Posted Wed Feb 9, 2011 1:58 PM

First off, you don't need to set a variable to move players. So the x = 50 and y = 50 are not necessary.

Just go player0x = 50, player0y = 50 instead.

Then later on to move them to player0x = player0x +1, etc.

#4 diogoandrei OFFLINE  

diogoandrei

    Chopper Commander

  • 210 posts
  • Location:Brazil

Posted Wed Feb 9, 2011 2:30 PM

Something like the attached files...

It's really better if you also attach your files in here, so someone can open them up and post a correction or something like that.

By the way, have you checked this thread?

Attached Files



#5 JorgeLiborinho OFFLINE  

JorgeLiborinho

    Space Invader

  • 17 posts
  • Location:Americana SP, Brazil

Posted Wed Feb 9, 2011 2:47 PM

Thanks everyone!
I've solved the problem!




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users