Cannot Place Sprite at Mouse Location

Exactly in the title:

code.org
(inside of world function)

(some of the variables are useless in this situation because in the actual game to place a block you press down a key so the variable orientation is useless and I also removed the math part of sprite (which was useless also in this situation) so don’t tell me that because I already know)

I’ll be honest. With this many lines of code and a program that goes well beyond what a student would create while taking this course, this is a difficult one to debug.

A few general suggestions, though. There are a lot of yellow warning triangles that should be looked at and cleaned up. For example, lines 416 and 423 and again lines 491 and 498 are telling you that you are trying to declare a variable that has already been declared. Normal practice would be to declare the variable at the top of the program and then refer to it in the function. This could be causing the problem because all 4 of those lines are where you are trying to create a sprite at the mouse location.

There are other warnings where you are trying to use variables outside the scope they were created in.

If I had to guess, I think it would be one of those issues that is causing the problems, but again, with this large of a program that I personally didn’t write, it could take me a lot of time to get my head around what you are trying to do and think through the possible errors.

Good luck on it! It’s ambitious, but it looks like a very fun game!

Mike

I have not worked with the sprites, but in Scratch there’s a way to set the addressed point (location on the sprite that goes to the requested coordinates). Don’t know if there’s a similar concept here but may be worth looking into.

It was like that when I first did it without adding the extra stuff, still didn’t work so that’s why in the first place I set it to a key bind so you could place the block.

I am pretty sure there is nothing like that here.