I’m trying to have the plants be placed on certain locations only. I’ve seen it be used before in some games so I would like to see if I can do it. If anyone could help I would appreciate it.
There are two ways you can do this:
For a placing area, you could have the game round to the nearest 32 pixel, or 1 block.
Another option is to have the original object send a message to the block that is on/near the place you want it to go and that object puts the block there.
I’m going to test the second one. Thx meburningslime since you’ve helped me in so many problems. You are the man
So if im not mistaken I should use a position and set it to the size of the block right?
The position block tells you where, in either sprites or pixels, the block will spawn. For sprite/grid coordinates, hover over a block and it will say the X/Y coordinates. For pixel coordinates, multiply that by 32.
For resizing, use the size block.
Im a little stuck. If you have the time could you send a screenshot of what I should do? Here is the game
If yes then check the peashooter and input the codes there
well that was fast! Thx
No problem! Just make sure that goes into the Grass Block code.
By the way, make sure the message “done” gets sent to all grass and that you have one set of this code for each plant. I recommend using the copy and paste feature, shown on the bottom left.
So I give all grass and plants the code. Got it
I took pictures of the peashooter and 2 grass blocks. Does this look good?
The bottom one, yes. Make sure when you select a plant it tells the grass the message.
Make it to where when you click the plant it messages all the grass blocks the name of the plant, ex. “Sun”. That way, the blocks will only emit if:
1: The sunflower is clicked.
2: The grass block is clicked.
3: No grass block was clicked before.
I also recommend you add a level select screen and some music!