I am making a little mario clone game and I have been stuck on this one problem for a while. I want to make it so that when the player jumps against a questionmark block that it disappears (mostly for testing purpose for now). I added the command
(player being the player, shroomblocks being the shroomblock and in the spawnMushroom function it just spawns a mushroom and executes the command shroomblock.kill();. Now it works fine but the problem is it deletes ALL questionmark blocks and not just the one the player collides with. Anyone could help me out?
I also tried to put something like this.shroomblocks as parameter into the function but it just gives me an error saying its undefined.
Thanks in advance for the help and if any more info is needed just ask away.
I tried putting your command in the create function and setting the 2 parameter in the spawnMushroom function but it gives me the error message “TypeError: Cannot read property ‘overlap’ of undefined phaser.min.js:20” in the console. Any ideas as to why?
Also could you explain what null and this do in the command you sent please?
oh damn my bad. I was using phaser 3 but then went back on a backup file of the game where i still had phaser 2.6.2 and didnt change it again. I will get phaser 3 and try again and tell you later if it works or not.
And yes im using the arcade physics just.
Edit: Actually i just saw i would have to rewrite most of the code and since I cant find a good documentation about how phaser 3 works I would rather keep my project on phaser 2.6.2 sorry again for the confusion. So can you help me with phaser 2.6.2 with arcade physics or should I open a new topic for phaser 2?