0

I'm making a game in Scratch where if they touch something their HP goes down. I'm planning on making multiple of the sprite appear without having to use clones or make several of the same sprite so I'm using the pen extension to draw it. I'm running into a problem though. When I tell it to change the variable by touching the sprite, the pen copy doesn't count as it so it won't change it. How do you make the variable change when touching the pen?

The main reason I don't plan on using clones is due to Scratch's 300 clone limit. I intend on having more than 300 of the thing i'm making, which would go over Scratch's clone limit and why most people use the pen to get around that. The answer marked as accepted technically solves the problem until that point so I marked it as correct.

ChocolateChara
  • 187
  • 1
  • 16
  • I think you'd have to either check the color, or put an invisible object over the pen drawing. Maybe there's other options but those seem like the most straightforward. Probably having the invisible clones is the better option. You'd have to make sure they get deleted at the right time of course. – Random Davis Apr 26 '22 at 19:28
  • I did try the color trick but then ran into another problem. It's a gaster blaster since i'm making a Error404 Sans Fan Fight, but as it fades out it apparently no longer counts as the same color. The invisible clones may work assuming you mean they are there as a kind of hitbox, and I could try to experiment with it. – ChocolateChara Apr 26 '22 at 19:41
  • Yeah I was thinking the clones could be a hitbox. Worth a try. – Random Davis Apr 26 '22 at 19:43
  • I tried it when I could and it works almost perfectly! – ChocolateChara Apr 27 '22 at 00:42
  • To rule out the possibility that this is an [XY problem](https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem), can you please explain _why_ you intend to work "without having to use clones"? Preferably by editing your question and describing your problem in more detail there. – Ruud Helderman Apr 27 '22 at 22:06
  • I say I don't want to work with clones mainly because I plan on having over 300 of them, which is the clone limit on scratch. The reason the clone hitbox worked for this is because I didn't get to the part where I plan to have over 300, when I do get there im going to have to find a way to make this happen but over 300 times. Don't ask why I plan on having 300 of the same thing I have it planned out lol. – ChocolateChara Apr 28 '22 at 12:48

1 Answers1

1

For the sake of providing a formal answer to this question, I'll just rehash the comments above.

A solution that worked ended up being to create an invisible (via the ghost effect) clone that goes over each pen drawing - each clone acting like a hitbox.

Random Davis
  • 6,662
  • 4
  • 14
  • 24
  • Please define 'invisible'. I tried: (1) the 'hide' block, (2) ghost effect 100, (3) change all colors to 'transparent' in the costume editor. Only the ghost effect worked. – Ruud Helderman Apr 27 '22 at 21:19
  • @RuudHelderman thanks for the additional info, I updated my answer. Although I would've been fine if you'd edited it yourself, just so you know. – Random Davis Apr 27 '22 at 21:21
  • How do envision this idea being used in practice? You'd either need a clone for each pen drawing (which defies the whole point of using pen to reduce the number of clones), or have a single clone jump around between pen drawings (which brings quite some coding overhead to guide the clone, based on coordinate lists). Either way, it seems like overkill, unless OP plans on having more clones than Scratch's maximum of 300. – Ruud Helderman Apr 27 '22 at 21:58
  • @RuudHelderman I don't really know, I gave a vague suggestion and didn't think about it much further and apparently it worked. Feel free to edit my answer or post a new one with a better idea; this was just *an* idea that worked in *this* case. I didn't elaborate because OP didn't provide any additional info on how their implementation worked. The question was pretty vague and broad and so I gave a similarly vague and broad answer, I'm not trying to spend all day coming up with a perfectly ideal optimal solution. If you have the time to do that, by all means, do it, I'm not stopping you. – Random Davis Apr 27 '22 at 22:23
  • @RuudHelderman as a matter of fact I do plan on going over the limit of 300 lol – ChocolateChara Apr 28 '22 at 12:55
  • And while I know having the hitbox as a clone itself does defy the point, it technically solves the problem I asked. – ChocolateChara Apr 28 '22 at 12:57