This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.
  • Index
  •  » Suggestions
  •  » New Scratch Function: Assigning "Tags" to Sprites for Better Detection

#1 2012-10-19 21:31:53

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

New Scratch Function: Assigning "Tags" to Sprites for Better Detection

I think that we should be able to assign tags to sprites for more efficient means of detection. This would be especially helpful in platformer games. For instance, the ground sprites. Here is what someone would normally use for their scripts (this is my personal style. idk about anyone else);

when gf clicked
forever
if <(touching? [sprite 1 v]) or <(touching? [sprite 2 v]) or <(touching? [sprite 3 v]) or (touching? [etc! ;b v])>>>
//execute actions here        
end
That script always becomes a pest, and fairly large if you're making some huge platformer/scroller

Instead of putting that code, I think we should be able to go to the menu where the scratch blocks are (upper left corner) and have another category called "Tags". It would work similar to the variables function, and when you clicked it, there would be various functions, two of which called "Create Tag" and "Delete Tag". When you create a Tag, you could name it whatever you want (sort of like a variable), then "assign" your created Tag to any sprite you wanted. In this case, we would assign the tag to all of your ground sprites in the project you're making. So let's say you made a tag called "ground". You could then go to all of the sprites you are going to use to simulate ground in your project, and under the control blocks you would see blocks that say something like ;
add me to Tag [Ground v]
delete me from Tag [Ground v]
I think this would make this sort of programming very very efficient. Your script would look something like this after you've created and assigned your tag;

when gf clicked
forever
if (touching? [Tag: Ground v])
//execute actions here

Zparx wrote:

In BYOB, I've actually put this script together but without tags. I edited a true/false sensing block, like this:

when gf clicked
forever
if <(touching [sprite 1 v]?) or (touching [sprite 2 v]?)>
report true
else
report false
And called the block "touching ground sprites?"

and it worked like a charm! I added 5 new sprites to the created block and it still worked flawlessly. So I doubt it will be hard to implement if BYOB has already (sort of) done it!

Let me know what you think!

--------------------
SUPPORTERS
-------------------


* Firedrake969
* Mokat
* 777w
* taddl
* dvd4
* ErnieParke
* subzerostig
* technoboy10
* Martiscratch
* Rexpup
* Willpower
* nitromian
* TorbyFork234
* scratchisthebest

Last edited by Zparx (2012-11-08 00:14:26)


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#2 2012-10-19 21:38:40

777w
Scratcher
Registered: 2009-02-10
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

interesting idea

Offline

 

#3 2012-10-19 21:39:22

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Mega support.


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#4 2012-10-19 21:42:53

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Support.


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#5 2012-10-19 21:43:59

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Thanks! I'll add you guys' names to the supporters list! (:


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#6 2012-10-19 21:49:25

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Duplicate.  Reporting to be closed.
EDIT:  Oh, and this

Last edited by Firedrake969 (2012-10-19 21:51:12)


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#7 2012-10-19 21:51:33

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Firedrake969 wrote:

Duplicate.  Reporting to be closed.

Organization and tagging are two completely different things. I don't think you fully understand my suggestion.


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#8 2012-10-19 22:02:38

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Firedrake969 wrote:

Duplicate.  Reporting to be closed.
EDIT:  Oh, and this

That's different...


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#9 2012-10-19 22:34:25

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Mokat wrote:

Firedrake969 wrote:

Duplicate.  Reporting to be closed.
EDIT:  Oh, and this

That's different...

Thank you..


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#10 2012-10-20 09:31:19

taddl
Scratcher
Registered: 2009-03-08
Posts: 100+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

support


http://blocks.scratchr.org/API.php?action=projects&amp;type=newest&amp;return=image&amp;user=taddl
http://blocks.scratchr.org/API.php?user=taddl&amp;action=projects&amp;type=newest&amp;return=text&amp;num=1

Offline

 

#11 2012-10-20 14:40:45

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

bumpdate


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#12 2012-10-20 14:56:24

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

I support your idea Sparks !  tongue

(I support your idea)


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#13 2012-10-20 15:45:40

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

This can really help in quite a few situations and I don't think that it'll be confusing for children, so I support.


http://i46.tinypic.com/35ismmc.png

Offline

 

#14 2012-10-20 16:15:28

subzerostig
Scratcher
Registered: 2010-09-08
Posts: 100+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Definitely support. For some projects I have to resort to 'touching colour?' Instead of touching sprite a - b


There are 10 types of people people in this world, those that understand binary and those that do not: My latest Project: Present catcher V2                          06/12/2012

Offline

 

#15 2012-10-20 19:49:59

dvd4
Scratcher
Registered: 2010-06-30
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

A proof of it's usefulness:

when gf clicked
forever
if <(touching? [sprite 1 v]) or <(touching? [sprite 2 v]) or <(touching? [sprite 3 v]) or <(touching? [sprite 4 v]) or <(touching? [sprite 5 v]) or (touching? [sprite 6 v])>>>>>
//execute actions here        
end
does this look simple ?

Last edited by dvd4 (2012-10-20 19:50:15)


I made a mod  big_smile  It's called blook!
http://i49.tinypic.com/16ia63p.png

Offline

 

#16 2012-10-21 09:22:46

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

dvd4 wrote:

A proof of it's usefulness:

when gf clicked
forever
if <(touching? [sprite 1 v]) or <(touching? [sprite 2 v]) or <(touching? [sprite 3 v]) or <(touching? [sprite 4 v]) or <(touching? [sprite 5 v]) or (touching? [sprite 6 v])>>>>>
//execute actions here        
end
does this look simple ?

exactly (:


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#17 2012-10-21 09:40:17

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Once, I worked for half an hour doing that, then realized that it didn't work and I deleted that script....


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#18 2012-10-21 09:45:08

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Firedrake969 wrote:

Once, I worked for half an hour doing that, then realized that it didn't work and I deleted that script....

Which script?


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#19 2012-10-21 10:08:03

northmeister
Scratcher
Registered: 2011-07-12
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

I think you may have suggested this before...  tongue


http://i48.tinypic.com/5a25g5.png

Offline

 

#20 2012-10-21 11:26:19

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

northmeister wrote:

I think you may have suggested this before...  tongue

I did, but everyone mistook it for "organizing" and putting the sprites in "folders" when that's not what I'm suggesting. I decided to reword some things so that hopefully people understand more clearly.


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#21 2012-10-21 11:45:53

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Support. This would be cool.


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#22 2012-10-21 19:14:52

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

technoboy10 wrote:

Support. This would be cool.

woop! updated the list.


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#23 2012-10-22 20:40:41

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

bump


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 

#24 2012-10-22 20:59:26

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

I support, but in the meantime you can use this relatively long workaround:

Make a list with a name of Tags:(TagName)
Then, for every sprite you have that you would want to be under that tag, you would put a

add [spritename] to [Tags:TagName v]
then, for sensing, you would do this:
when I receive [touching tagName v] //has to be under the sprite that you want to be checked for touching
set [i v] to [1]
set [touching v] to [0]
repeat <length of [Tags:TagName v]>
if <touching <item (i) of [Tags:TagName v]>?>
set [touching v] to [1]
end
change [i v] by (1)
end
if <(touching)=[1]>
say [you touched one of the sprites with a tag of tag name!]
end
Alternatively, for that script, since it's only for sensing, if you want to make it go faster, you could change the repeat to this:
repeat until <<((i)+(1))=<length of [Tags:TagName v]>>or<(touching)=[1]>>
end
You could also just have the bunch of or's sitting at the edge of the screen, and when you need it just duplicate it.

Anyways, it would be better to have it built in.

Offline

 

#25 2012-10-22 22:24:39

Zparx
Scratcher
Registered: 2011-03-23
Posts: 500+

Re: New Scratch Function: Assigning "Tags" to Sprites for Better Detection

TorbyFork234 wrote:

I support, but in the meantime you can use this relatively long workaround:

Make a list with a name of Tags:(TagName)
Then, for every sprite you have that you would want to be under that tag, you would put a

add [spritename] to [Tags:TagName v]
then, for sensing, you would do this:
when I receive [touching tagName v] //has to be under the sprite that you want to be checked for touching
set [i v] to [1]
set [touching v] to [0]
repeat <length of [Tags:TagName v]>
if <touching <item (i) of [Tags:TagName v]>?>
set [touching v] to [1]
end
change [i v] by (1)
end
if <(touching)=[1]>
say [you touched one of the sprites with a tag of tag name!]
end
Alternatively, for that script, since it's only for sensing, if you want to make it go faster, you could change the repeat to this:
repeat until <<((i)+(1))=<length of [Tags:TagName v]>>or<(touching)=[1]>>
end
You could also just have the bunch of or's sitting at the edge of the screen, and when you need it just duplicate it.

Anyways, it would be better to have it built in.

This is an effective method, and I've used it in some of my big games, such as "Cyber Defense" in which I added 10 sprites to the list. It worked fine because the turrets didn't require quick touch sense detection. However, if I had 10 or more ground sprites added to a list for a platformer and used this method, it would be very ineffective unless I used turbo mode.

Last edited by Zparx (2012-10-22 22:25:09)


http://images3.wikia.nocookie.net/__cb20101119183412/halo/images/4/43/Hero2.png
^ My rank on Halo: Reach :3

Offline

 
  • Index
  •  » Suggestions
  •  » New Scratch Function: Assigning "Tags" to Sprites for Better Detection

Board footer