This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-04-15 03:07:25

Matty3414
Scratcher
Registered: 2011-04-09
Posts: 100+

Costume Glitch

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


http://i.imgur.com/i87ba.pngDesigner - Photoshop, C4D

Offline

 

#2 2011-04-15 03:47:52

Matty3414
Scratcher
Registered: 2011-04-09
Posts: 100+

Re: Costume Glitch

no one likes to help the Newbies  sad


http://i.imgur.com/i87ba.pngDesigner - Photoshop, C4D

Offline

 

#3 2011-04-15 10:43:30

Mister_H
New Scratcher
Registered: 2011-04-15
Posts: 2

Re: Costume Glitch

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

 

#4 2011-04-15 11:53:52

CloneCommando1
Scratcher
Registered: 2010-12-02
Posts: 500+

Re: Costume Glitch

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.  hmm


RANDOM THOUGHT: If the tomato is a fruit, doesn't that make ketchup a smoothie?

Offline

 

#5 2011-04-15 13:06:07

Paddle2See
Scratch Team
Registered: 2007-10-27
Posts: 1000+

Re: Costume Glitch

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]


http://i39.tinypic.com/2nav6o7.gif

Offline

 

#6 2011-04-15 17:27:59

Matty3414
Scratcher
Registered: 2011-04-09
Posts: 100+

Re: Costume Glitch

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  big_smile , I might try that varible 1 though


http://i.imgur.com/i87ba.pngDesigner - Photoshop, C4D

Offline

 

#7 2011-04-15 17:38:54

Matty3414
Scratcher
Registered: 2011-04-09
Posts: 100+

Re: Costume Glitch

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?


http://i.imgur.com/i87ba.pngDesigner - Photoshop, C4D

Offline

 

#8 2011-04-15 21:18:48

Matty3414
Scratcher
Registered: 2011-04-09
Posts: 100+

Re: Costume Glitch

Fixed it! Dont worry anymore


http://i.imgur.com/i87ba.pngDesigner - Photoshop, C4D

Offline

 

#9 2011-04-18 13:08:48

CloneCommando1
Scratcher
Registered: 2010-12-02
Posts: 500+

Re: Costume Glitch

Yay!


RANDOM THOUGHT: If the tomato is a fruit, doesn't that make ketchup a smoothie?

Offline

 

#10 2011-04-19 03:56:39

gavgog2
Scratcher
Registered: 2010-03-31
Posts: 33

Re: Costume Glitch

i have the same problem and ive ben scratching for 5 years its a basic but comon glitch

Offline

 

#11 2011-04-19 04:56:25

Matty3414
Scratcher
Registered: 2011-04-09
Posts: 100+

Re: Costume Glitch

I fixed it......


http://i.imgur.com/i87ba.pngDesigner - Photoshop, C4D

Offline

 

Board footer