0

Like I have stated here, I am trying to create a Plants v.s Zombies mod in Scratch. However, the main issue still seems to be that the drag and drop system just does not seem to want to work. (This would be clicking the seed packet and then dropping it where it needs to be dropped.) The problem is, it seems to be working now, but only other than the fact that this happens:

It doesn't work. All it seems to do is make a clone of the plant, and nothing else.


Note: I have already stated the rest of the code in my previous question, and nothing seems to be wrong with that, so that is why I am only mentioning the code to create the drag and drop system

The code that I use to create the drag-and-drop system


Sending the message when sprite is clicked

[scratchblocks]
when I receive [message 1 v]
create clone of [myself v]
[/scratchblocks]

The code when the sprite starts as a clone:


[scratchblocks]
when I start as clone
show
set [brightness v] effect to (40)
switch costume to [costume 2 v]
set drag mode [draggable v] :: sensing
go to x: (mouse x) y: (mouse y)
forever
if <[<mouse down?>] = [1]> then
wait until <>
forever
go to x: (mouse x) y: (mouse y)
end
else
delete this clone
end
end

enter image description here

However, it doesn't seem to be working. Why would the code be like this?

CrSb0001
  • 151
  • 1
  • 11
  • 1
    Remove the empty `wait until` block. The absence of a condition probably defaults to 'false', meaning it will wait indefinitely and never reach the `forever` loop that you are using to position the clone. This will not solve _all_ of your problems, but it should help you move on. – Ruud Helderman Jun 02 '23 at 12:00
  • @RuudHelderman Now the peashooter clone is three lawn spaces away from my mouse, what would you recommend I do from here? – CrSb0001 Jun 02 '23 at 12:31
  • 1
    I see your project has multiple issues, but elaborating on those would be off-topic for this particular question. Stack Overflow is a knowledge base, not a debugging platform. If you need somebody help you fix your project, please use the [forum](https://scratch.mit.edu/discuss/7/). It's where the real experts are. – Ruud Helderman Jun 02 '23 at 14:09

1 Answers1

1

I think you need to remove the second forever so that you can drop the plant, because right now it just goes to the mouse position forever. Also, if the sprite is not on your mouse, you should check that the image of the plant is centered

Theo Nimz
  • 13
  • 5