I am loving MakeCode Arcade, but I keep running into a snag. When I try to make a projectile from a sprite and I have a tile with wall on and a tile map with walls, the projectile doesn’t appear to spawn except maybe horizontally to the right.
I first found this on the happy flower tutorial when making a basic exterior wall tilemap with the flower sprite in the middle. With wall off, the bees spawn fine, but when I turn wall on for a tile, they rarely spawn.
I’ve been using the code blocks interface. I’m on a different machine, so can’t post my example yet, but wanted to check if I’m the only one or if there’s a bug with projectiles and walls. Thanks!
Hm, that sounds potentially related to (/ the same as) this bug?
I haven’t had time to take a look at that bug quite yet, but a shared scripted would be useful to help debug when you have time - what is likely happening is that the projectile is hitting a wall, and by default projectiles have the
destroy on wall flag turned on, making it be destroyed immediately. It’s also possible that they’re spawning outside of the tile map (temporarily at least?), and the collision detection isn’t bumping them in properly.
Though if you’re doing the happy flower tutorial, they should be coming from the sprite, which would make this extra weird… will take a look tomorrow :).
I added a little console output and found that the projectile does show up when either the vx or vy are set to 0. I played around with partial walls a bit and found that some other velocities worked.
What is really interesting is that an “on created sprite kind of projectile” block throws a “failed cast on null” error when trying to reference the x and y positions of the projectile sprite.
A little more debugging can be found here (removing the “on created” block will remove the null casting error): https://makecode.com/_P37TRH6heMKf