This is my topic, The Coder King. I attempted to make it two player. But it freezes when you choose your character. Could you please help me? @WoofWoof? Here’s the link. The Coder King. Thank you.
I’ll look at the code when I get home, but how do you get past this screen?
My guess is that you have to wait until another player joins, though I thought I saw some code for handling single player games, so… uhh… yeah
Well that’s the thing, it’s not supposed to freeze there.
Well, it’s supposed to act like a single player until someone else joins and then it becomes two player. Could you help me and make it so it doesn’t freeze when it’s waiting for the other player to pick their character @WoofWoof? I need this. Here’s the updated link: The Coder King
P.S. @WoofWoof, you are in the game as an unlockable character. Once you reach 3 wins, you are unlocked. Wait until you get 9 wins, then you unlock THE MODS!!!
Please help me, @WoofWoof, you’re my only hope… (star wars reference)
Ok so it looks like the issue is with the Pause Until blocks in the On Game Update block. When you pause inside an On Game Update block it pauses everything because On Game Update blocks aren’t “Multithreaded”. Basically makecode has a built in system for fake multithreading, which is where two sets of code can run at the same time. Makecode can’t do that, but it fakes it by letting other bit of code run when one bit of code is paused. Your issue is that only certain blocks are wrapped in that fake multithreading code… like the Forever block! So putting that whole code section inside a Forever block should fix your issue, because makecode will let the cursor movement code run while those pause until blocks are running. Hope this helps! This game looks very neat, and I like my character!
edit thanks for the likes (jk jk)
ok, thanks @WoofWoof, but I encountered another error. I think it explains itself. PS I started coding in JavaScript cuz the Blocks were getting too laggy, I hope you don’t mind, but…
My deepest, darkest secret
I’m still learning. Hehehe?
It most certainly explains itself XD
Your issue is on line 10361:
Using debug mode, I can see that both “playerhealth” and “fighter” are both null when this line of code is run. This is the classic “sprite doesn’t exist yet” issue and should be easy to fix, have fun! Nice to see someone using JavaScript!
Pro tip: you can use the “!=” operator to check that some numbers are not equal, which will let you avoid doing this:
oh… no brainer.
Hey @WoofWoof, sorry if I’m getting annoying, (I’m a bad coder) but I have another problem. The computer player stops at the wall, and doesnt move, just stays there for the rest of the match, dying. Could you try to find what’s causing it, and fix it? You can even give yourself an op move. Also, I made a mobile mode, so you can play it on your tablet or phone, just there are limited characters. The Coder King
Um, @WoofWoof?
I’m on a trip with only my phone for a few weeks. I’ll look at it when I return and have a computer.
ok, while you’re at it, could you add this gif to the start of the game? It’s not crucial, and it doesn’t HAVE to be done, but idk know how to use the gif converter
Could u help me fix the problem:face_holding_back_tears:
I knew I had some stuff to do when I got back, just couldn’t quite remember what! I’ll look at this very soon.
I see the issue you are talking about, but where in your code controls the position or speed of com2? Does a certain part tell it to move based on what tiles it’s next to or on top of?
It is powered by a game update block. every 500 ms or so, it moves (set cm2 velocity to vx (pick random from -70 to 70) vy (pick random from -70 to 70).