Ok so i'm making a game like pokemon, i've got my in-game sprite sprite, i've got it to move up, but when no key is Pressed, (i have the if else box<if><else>) I've got switch costume 'Boy-up-1' So that doesn't work cause....
I've got the same thing but the sprite goes down but on the else box I've got switch costume to 'Boy-Down-1' so that one works fine, but when i go up when i've got no key pressing down it goes to the 'Boy-down-1' not 'Boy-up-1' Is there anyway i can make it so it knows is history and stays on the up sprite not the down sprite? Thx
Offline
you could use a variable to keep track of what state the costume is in.
set it to 1 for costume 1
set it to 2 for costume 2
then you can use the variable to test which costume to change to in your if
don't forget to update the variable every time you change costumes
hope this helps
Offline
Although I don't make games (yet), I try to avoid variables altogether. But I'm not a pokemon fan myself, so I'm not entirely sure what you're trying to do. Sorry.
Offline
I'm not sure I totally understand what you are asking...but it sounds like you are trying to set a costume based on one of three states: Up key pressed, Down key pressed, No key pressed. I guess, I would probably do that in a loop with a couple of nested If-then-elses like this
[blocks]
<when green flag clicked>
<forever>
<if> <key[ Up Arrow ]pressed?>
<switch to costume[ Up
<else>
<if> <key[ Down Arrow ]pressed?>
<switch to costume[ Down
<else>
<switch to costume[ Neither Up nor Down
<end>
<end>
<end>
[/blocks]
Offline
Paddle2See wrote:
I'm not sure I totally understand what you are asking...but it sounds like you are trying to set a costume based on one of three states: Up key pressed, Down key pressed, No key pressed. I guess, I would probably do that in a loop with a couple of nested If-then-elses like this
[blocks]
<when green flag clicked>
<forever>
<if> <key[ Up Arrow ]pressed?>
<switch to costume[ Up
<else>
<if> <key[ Down Arrow ]pressed?>
<switch to costume[ Down
<else>
<switch to costume[ Neither Up nor Down
<end>
<end>
<end>
[/blocks]
Heres my full code
for that Part
<when green flag clicked>
<forever>
<if> <key[ up arrow ]pressed?>
<switch to costume[ boy-up-2
<change y by( 7
<wait( 0.5 ) secsc>
<switch to costume[ boy-up-3
<change y by( 7
<wait( 0.5 ) secsc>
<else>
<switch to costume[ Boy-up-1
And to the people who dont know what i'm doing, i'm recreating pokemon , I might try that varible 1 though
Offline
Mister_H wrote:
you could use a variable to keep track of what state the costume is in.
set it to 1 for costume 1
set it to 2 for costume 2
then you can use the variable to test which costume to change to in your if
don't forget to update the variable every time you change costumes
hope this helps
I dont get what you mean, well i kinda do, like If the Costume up varible is set to 1 on else its set to 1 but that would effect the otheres wouldn't it?
Offline
Yay!
Offline