So, I’m making an inventory screen in my game, and it’s working, kind of. I got it working perfectly in the scene for Sector 1, and I copied the screen to other scenes, believing that they would work the same way in all scenes, but I decided to start testing out Wraith lord’s scene, and it completely broke there. It’s still perfectly fine in Sector 1, but I can’t figure out the issue other than that it’s spaghetti code. I haven’t tested it out on any of the other scenes, just Wraith Lord’s.
Sector 1 scene: PlayCanvas | HTML5 Game Engine
Wraith Lord Boss Test Scene: PlayCanvas | HTML5 Game Engine
Inventory Script Editor: PlayCanvas | HTML5 Game Engine
Also, I’ve been using a screen fade ESM JS file to use for the scene transition, and it required Tween.js, but the new update forced me to turn Tween.js to the latest version ESM version, and I couldn’t find an updated version for the Scene Transition one. I only know CommonJS, and I have no idea how to update SceneTransition.js to the updated MJS script or how to turn it into CommonJS, so I need help there.
SceneTransition.js: PlayCanvas | HTML5 Game Engine
Hi @Linkplayer! 
In this scene I’m be able to get some erros, but I have no idea which one is related to your question.
In this scene nothing seems to happen, I can just move around.
Personally, I scripted out the Tween library completely. I couldn’t get the same setup working with the newest version and to be honest I got tired of constantly tweening between working code and new errors.
If you press the enter key in the two scenes, you’ll pull up the inventory menu. In Sector 1 (and as I’ve tested out later in Sector 3), the inventory screen fades in properly (which is a placeholder until I get the time to make the actual screen), the flash happens (which is intentional), and everything appears as intended. However, in the test fight with Wraith Lord, when you press the Enter key, the screen immediately pops into existence, and things don’t disappear properly. There is the pointer/indicater of where the player is selecting, and it works properly in the sector scenes, but in Wraith lord, once you are:
- enter the menu by pressing the Enter key
- press the A key to switch to the power mail section, or press the D key twice to do the same (one tap of the D key takes you to inventory, but there is currently nothing in inventory)
The indicator appears as it should, but it never disappears, not even by closing the menu; however, I cannot tell where that bug is coming from.
Also, using developer tools, I noticed some errors too, but none of the errors I’ve seen appear in the system until screen fade is called, in which it gives me an error that it isn’t working. I believe that it’s still caused by the update, since it’s written the same way as Tween used to be. I guess that I should change it to a CommonJS system to allow myself to work on it.
Also, note: I was testing out if the trigger actually worked in the Wraith Lord test scene a while back and forgot to move it back to (0,0,0), so to trigger the boss, you just walk to the left a little bit, and the health bar will appear, and he’ll start attacking, but there is no arena as I haven’t worked on it yet
Actually, I found the solution to why it didn’t work for the inventory menu, I had two 2D screens with the inventory, since I forgot to delete the one I don’t need after adding the pause screen to the 2D screen template
Anyway, back to screen transitions. I got it working by using an element with a 1 pixel image that’s a black square (which I found out I still had there) stretched over the entire screen. I’m making a tilemap script, for those who remember, but there’s a slight problem: it takes around a 15-frame loop for the small set of 26x24 tiles to do their position and image updates; however, I want the screen to fade back to gameplay only AFTER the tiles have been set, but I don’t want complicated systems to do it; I just want a check to make sure that they’re in place before the screen fades out, I could also probally tweak the system’s nature to make it move faster as well, that would also be a little helpful.
Tilemap Script: PlayCanvas | HTML5 Game Engine
Tilemap test script: PlayCanvas | HTML5 Game Engine
Also, if you are wondering about the structure, it was a little laggy on my computer when it did math every frame; then every 15 frames caused lag spikes, so I split them up into 14 groups to run in a 15-frame cycle, one on each frame, with the last one being ignored. it allows my Chromebook to run at a consistent average of 59.4 FPS, which I know isn’t good, but…
1 Like