Discuss Scratch

kindsolo
Scratcher
23 posts

Grouping sprites and better "dont phase though the floor please" mechanics

Is there a way to group spites together so you can call on the sprite group insite of a singular sprite?
For example:

if touching (floor) then
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

instead of:

if touching (sprite1 and spite2 and sprite3) then
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

I could use one srite for all of the floor spites via clones but I would prefer to have multibule templets instead of one to reduce the headache.
I have an idea but I would llike more opoins if posible:

get first (5) letters of “SpriteTouching” if (Floor) than
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

EDIT: Also has anyone has succes with “dont phase though the floor please” mechanics? I am trying to make a 2D platformer (like super meatboy). Could you link your project so I can check it out?

Thanks!

Last edited by kindsolo (March 2, 2023 18:40:26)

NeonG4
Scratcher
1000+ posts

Grouping sprites and better "dont phase though the floor please" mechanics

kindsolo wrote:

Is there a way to group spites together so you can call on the sprite group insite of a singular sprite?
For example:

if touching (floor) then
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

instead of:

if touching (sprite1 and spite2 and sprite3) then
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

I could use one srite for all of the floor spites via clones but I would prefer to have multibule templets instead of one to reduce the headache.
I have an idea but I would llike more opoins if posible:

get first (5) letters of “SpriteTouching” if (Floor) than
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

EDIT: Also has anyone has succes with “dont phase though the floor please” mechanics? I am trying to make a 2D platformer (like super meatboy). Could you link your project so I can check it out?

Thanks!
You could make a list, storing the costume names.
spritenames
1. sprite 1
2. sprite 2
3. sprite 3
set [i v] to [0]
repeat (length of [spritenames v] :: list)
change [i v] by (i)
if <touching (item (i) of [spritenames v] :: list) ?> then
...
end
end

Last edited by NeonG4 (March 2, 2023 18:48:00)

kindsolo
Scratcher
23 posts

Grouping sprites and better "dont phase though the floor please" mechanics

NeonG4 wrote:

kindsolo wrote:

Is there a way to group spites together so you can call on the sprite group insite of a singular sprite?
For example:

if touching (floor) then
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

instead of:

if touching (sprite1 and spite2 and sprite3) then
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

I could use one srite for all of the floor spites via clones but I would prefer to have multibule templets instead of one to reduce the headache.
I have an idea but I would llike more opoins if posible:

get first (5) letters of “SpriteTouching” if (Floor) than
set “TouchingFloor” to (0)
else
set “TouchingFloor” to (1)
;

EDIT: Also has anyone has succes with “dont phase though the floor please” mechanics? I am trying to make a 2D platformer (like super meatboy). Could you link your project so I can check it out?

Thanks!
You could make a list, storing the costume names.
spritenames
1. sprite 1
2. sprite 2
3. sprite 3
set [i v] to [0]
repeat (length of [spritenames v] :: list)
change [i v] by (i)
if <touching (item (i) of [spritenames v] :: list) ?> then
...
end
end
This is perfect! Thanks!
NeonG4
Scratcher
1000+ posts

Grouping sprites and better "dont phase though the floor please" mechanics

kindsolo wrote:

snip!
Yw!

Powered by DjangoBB