Discuss Scratch
- Discussion Forums
- » Developing Scratch Extensions
- » How to connect a hat block to a sprite
- zjn0505
- New to Scratch
4 posts
How to connect a hat block to a sprite
I am developing an extension to interact with a robot via socket.io connection.
I've already made connect and control command blocks like.
I also made some hat blocks to get battery, arrival of locations, etc.
Now I am moving on to next step to do multiple robots connection, and I am thinking to connect a sprite with the robot, so multiple robots means multiple sprites.
I know with command block, I can get `util.target` to know where the command is sent from, so a connection pool can be used to manage target of command.
But what about hat block, saying when battery of 1 robot changes, how can I only trigger the function of a specific hat block?
Do I have to add arguments to the hat block?
I've already made connect and control command blocks like.
Connect robot SN [123]
Move forward
Go to [kitchen]
I also made some hat blocks to get battery, arrival of locations, etc.
Now I am moving on to next step to do multiple robots connection, and I am thinking to connect a sprite with the robot, so multiple robots means multiple sprites.
I know with command block, I can get `util.target` to know where the command is sent from, so a connection pool can be used to manage target of command.
But what about hat block, saying when battery of 1 robot changes, how can I only trigger the function of a specific hat block?
Do I have to add arguments to the hat block?
- zjn0505
- New to Scratch
4 posts
How to connect a hat block to a sprite
I see in util there is a method of startHats
- zjn0505
- New to Scratch
4 posts
How to connect a hat block to a sprite
I tried util.startHats and runtime.startHats with “EXTENSION_ID_OPCODE” and it works.
So I suppose I should look into https://docs.turbowarp.org/development/extensions/hats#filtering-by-sprite to add filter
So I suppose I should look into https://docs.turbowarp.org/development/extensions/hats#filtering-by-sprite to add filter
- zjn0505
- New to Scratch
4 posts
How to connect a hat block to a sprite
Mostly resolved, just one issue left.
https://github.com/scratchfoundation/scratch-vm/issues/4128
https://github.com/scratchfoundation/scratch-vm/issues/4128
- emosins34
- Scratcher
58 posts
How to connect a hat block to a sprite
What? I touch grass every day! touch grass
- orangeluigi
- Scratcher
55 posts
How to connect a hat block to a sprite
What? I touch grass every day! touch grass
please don't off-topic post
A robot extension sounds cool. Is there a specific robot you're connecting it to?
i do stuff on the forums sometimes
✊ Support the suggestion HERE by adding this button to your signature ✊
Check out PuppyX!
https://scratch.mit.edu/projects/979941376/
when flag clicked
forever
if <I make project::sensing> then
make project (better v)::sensing
if < <awesomeness of new project::sensing> < <awesomeness of old project::sensing> > then
go back::events
if <not <<new project::sensing> = <old project::sensing>>::operators> then
GO BACK::events
end
why are you here
- Discussion Forums
- » Developing Scratch Extensions
- » How to connect a hat block to a sprite