Discuss Scratch

thechief389
Scratcher
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.
mstone326
Scratcher
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
Scratcher
88 posts

Set costume based on direction

mstone326 wrote:

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.
But the sprites I want to use have costumes.

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
Scratcher
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
Scratcher
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/

Last edited by mstone326 (Oct. 15, 2017 14:26:02)

thechief389
Scratcher
88 posts

Set costume based on direction

mstone326 wrote:

See if this helps. I think this is somewhat close to what you are trying to do.

https://scratch.mit.edu/projects/180022050/
I basically wand direction and costume change.
thechief389
Scratcher
88 posts

Set costume based on direction

mstone326 wrote:

See if this helps. I think this is somewhat close to what you are trying to do.

https://scratch.mit.edu/projects/180022050/
I basically wand direction and costume change.
mstone326
Scratcher
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
Scratcher
88 posts

Set costume based on direction

mstone326 wrote:

Without seeing the project and exactly how you are trying to implement that it is difficult to guess exactly what you are looking for.
The script may look like this.
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.
asivi
Scratcher
1000+ posts

Set costume based on direction

One silly question, why 18 costumes?
thechief389
Scratcher
88 posts

Set costume based on direction

asivi wrote:

One silly question, why 18 costumes?
I’m using the sprites from the snes game super Mario kart

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
Scratcher
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
Scratcher
88 posts

Set costume based on direction

asivi wrote:

What is the direction for the latest costume? How re you changing direction? how much degrees at a time?
Probably 2. I can only figure out 90, -90, 0, and 180
asivi
Scratcher
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
Scratcher
88 posts

Set costume based on direction

asivi wrote:

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.
Can you give me a scratchblocks example?
asivi
Scratcher
1000+ posts

Set costume based on direction

Epic fail! sorry the appropiate number of costumes woul be 18 for a distance of 20 degrees..
asivi
Scratcher
1000+ posts

Set costume based on direction

thechief389
Scratcher
88 posts

Set costume based on direction

asivi wrote:

https://scratch.mit.edu/projects/180754843/
Perhaps?
That was exactly what I was looking for. Thanks.
thechief389
Scratcher
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
Scratcher
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.

Powered by DjangoBB