Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Set costume based on direction
- thechief389
-
88 posts
Set costume based on direction
I'm making a vertical 2-D racing game and I can't figure out how to make the sprite costumes look like it's rotating.
There are 18 costumes in the sprite and I was wondering if there were any operator blocks that would help me.
Can any one figure out how to make it work.
There are 18 costumes in the sprite and I was wondering if there were any operator blocks that would help me.
Can any one figure out how to make it work.
- mstone326
-
1000+ posts
Set costume based on direction
Can you share the project? Is this a top down racing game? If so, you could use the rotate blocks instead of costumes. If it is an old school camera behind the car game then you could set some parameters of what costumes to switch to and when to stop switching.
- thechief389
-
88 posts
Set costume based on direction
But the sprites I want to use have costumes. Can you share the project? Is this a top down racing game? If so, you could use the rotate blocks instead of costumes. If it is an old school camera behind the car game then you could set some parameters of what costumes to switch to and when to stop switching.
Here's one of them:

I don't want to share the project because someone might steal it. (and that is why we should be able to share projects privately)
BTW 3d is really complicated and hard to make on Scratch.
Last edited by thechief389 (Oct. 15, 2017 13:46:19)
- mstone326
-
1000+ posts
Set costume based on direction
Going to be hard to help. I'll try to make a quick example project if I have sec.
- mstone326
-
1000+ posts
Set costume based on direction
See if this helps. I think this is somewhat close to what you are trying to do.
https://scratch.mit.edu/projects/180022050/
https://scratch.mit.edu/projects/180022050/
Last edited by mstone326 (Oct. 15, 2017 14:26:02)
- thechief389
-
88 posts
Set costume based on direction
I basically wand direction See if this helps. I think this is somewhat close to what you are trying to do.and costume change.
https://scratch.mit.edu/projects/180022050/
- thechief389
-
88 posts
Set costume based on direction
I basically wand direction See if this helps. I think this is somewhat close to what you are trying to do.and costume change.
https://scratch.mit.edu/projects/180022050/
- mstone326
-
1000+ posts
Set costume based on direction
Without seeing the project and exactly how you are trying to implement that it is difficult to guess exactly what you are looking for.
- thechief389
-
88 posts
Set costume based on direction
The script may look like this. Without seeing the project and exactly how you are trying to implement that it is difficult to guess exactly what you are looking for.
if <(direction) = [0]> then
switch costume to [costume1 v]
end
if <(direction) = [90]> then
switch costume to [costume5 v]
end
if <(direction) = [180]> then
switch costume to [costume9 v]
end
if <(direction) = [-90]> then
switch costume to [costume13 v]
end
I can't figure out the values for the costumes between those numbers.
- thechief389
-
88 posts
Set costume based on direction
I’m using the sprites from the snes game super Mario kart One silly question, why 18 costumes?
Look for finlay_cool’s MARIO kart project. That has costume based direction but without the direction variable
Last edited by thechief389 (Oct. 18, 2017 16:53:46)
- asivi
-
1000+ posts
Set costume based on direction
What is the direction for the latest costume? How re you changing direction? how much degrees at a time?
- thechief389
-
88 posts
Set costume based on direction
Probably 2. I can only figure out 90, -90, 0, and 180 What is the direction for the latest costume? How re you changing direction? how much degrees at a time?
- asivi
-
1000+ posts
Set costume based on direction
Well, if you create 17 costumes only you will obtain a distance in degrees of 20 betwwen them. Since 20 is an integer you can avoid decimals making the task more simple and reliable.
- thechief389
-
88 posts
Set costume based on direction
Can you give me a scratchblocks example? Well, if you create 17 costumes only you will obtain a distance in degrees of 20 betwwen them. Since 20 is an integer you can avoid decimals making the task more simple and reliable.
- asivi
-
1000+ posts
Set costume based on direction
Epic fail! sorry the appropiate number of costumes woul be 18 for a distance of 20 degrees..
- thechief389
-
88 posts
Set costume based on direction
https://scratch.mit.edu/projects/180754843/That was exactly what I was looking for. Thanks.
Perhaps?
- thechief389
-
88 posts
Set costume based on direction
One problem I have is that if you add more than 18 costumes to the sprite e.g. other characters, it switches to the 19th or higher costumes.
- mstone326
-
1000+ posts
Set costume based on direction
You could use something like if costume # > 18 set costume to 18. That will lock it at 18.
- Discussion Forums
- » Help with Scripts
-
» Set costume based on direction