ItsYaBoiWesley

Members
  • Content Count

    28
  • Joined

  • Last visited

About ItsYaBoiWesley

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. I'm going to do a CSS spinner. I know this is a stupid question, but how does one overly such a spinner on top of an HTML5 canvas? That's where my game is. And how do you control it with JS
  2. Nevermind, the problem was in the last line. Instead of clearing all the arrays, it somehow combined them!
  3. Hey guys. I'm using CreateJS to make my javascript game. According to the documentation, objects are layered one on top of the other, in order of their addition to the stage. To control layering, I push to multiple "layer" arrays, and add the objects from those layers. However, it isn't working! Objects that are created first are the ones on the bottom, not objects that are added first. Here's my adding code, as you can see it adds in order of the arrays. for(let a = 0; a < blockLayer.length; a++) { stage.addChild(blockLayer[a]) } for(let b = 0; b < floorLayer.length; b++) { stage.addChild(floorLayer[b]) } for(let c = 0; c < entityLayer.length; c++) { stage.addChild(entityLayer[c]) } for(let d = 0; d < lightLayer.length; d++) { stage.addChild(lightLayer[d]) } for(let e = 0; e < uiLayer.length; e++) { stage.addChild(uiLayer[e]) } stage.update(); blockLayer = floorLayer = entityLayer = lightLayer = uiLayer = []; Anyone with experience in CreateJS? Help would be really appreciated!
  4. Sorry, hate to bump posts... But does anyone have any idea how to do this?
  5. Hi everyone! Coding question incoming... I have a number of loading functions (asset loading, world generation, things like that) and I want to have a loading screen running while loading. Something like a loading spinner or progress bar. But here's the thing, I understand JavaScript is single-threaded. So, how do I do simultaneous visuals and loading? Is there some way to run both tasks in parallel? Can I somehow create a CSS loading spinner and overlay it onto my JS canavs? (I have no experience with CSS) Thanks! -Wesley
  6. Hey, guest sign in didn't work for me. I clicked "Guest Sign Up" a bunch and nothing happened.
  7. Can anyone help me out here? I suppose I need more explicit instruction...
  8. I looked at this code. While I found it helpful, I still don't know the exact line of code that unlocks. What exactly does the unlocking? I'm just confused - JavaScript is still pretty new for me so looking at the Phaser code is a little confusing.
  9. Ok, can you give me an example of an "allow" function to allow this on initialization?
  10. Hi! I've been trying to get my JavaScript game to play sound using the HTML5 audio stuff. I am getting a security error when I run the ".play" method. From my research, this is a new security measure implemented into Google Chrome regarding auto-play on websites. Does anyone know how to get around it? Uncaught (in promise) DOMException: play() failed because the user didn't interact with the document first. I've tried the "SoundJS" and "HowlerJS" libraries. Both of these libraries are rendered inoperable by the new error. The only workaround I've found is making audio play (running ".play()" on a keypress) This makes sense, as Chrome doesn't want its users being caught off guard with random audio. However, I need my game to play audio on its own accord. (sound effects, some ambiant music randomly begins, etc) Right now, I'm trying the instructions found here. When I put that exact code into my code, it throws the error - but when I play the demo on their site of presumably the same code, it runs fine and I can hear the sound in their example. How come I can here everything fine in their example, but their exact code throws an error in mine? (And doesn't play any sound!) Any help with this issue would be awesome. I'm so tired of trying different libraries, different methods, trying to work with the "Promise" system, and more. So believe me, any help would be GREATLY appreciated! Yikes! 😂
  11. Thanks! I got it now. I added an exportString and importString methods to my classes. They simply take all relevant data about an entity, stick it in an array, and stringify it. Then this data is easy to transport.
  12. Hi! I'm trying to save game data in JavaScript, using "localStorage". I have a class called "Entity" with its own variables and functions. I have an array called "loadedEntities" which contains instances of the Entity class. For example var zombie = new Entity(args) var spider = new Entity(args) loadedEntities = [zombie, spider] I want to save the entirety of "loadedEntities." To do this, I use JSON.stringify(loadedEntities). (I save the entire array in one big gulp) Then, when I want to load the data back into the game, I use JSON.parse(). (My load function sets loadedEntities equal to whatever JSON.parse() returns.) Now, whenever I try to run a function on an entity, (The entity class has its own functions. So, loadedEntities[0].move() or loadedEntities[1].attack()) I get the following error: loadedEntities[i].attack is not a function //i is a good and proper variable. Everything works fine when a "New Game" is selected. The issue definitly has to do with saving My theory is that when I save instances of the Entity class, the data might get saved but the functions, like "attack()" don't get saved or something. I don't know, what do you guys think?
  13. Hi! I'm trying to make a 2D array with a ton of zeroes. For some reason, this does not work. (By does not work, I mean I get errors when accessing the array. If I initialize the array manually, it's smooth sailing.) var blankRow = []; for(var x = 0; x < world[0].length; x++) { blankRow.push(0); } for(var y = 0; y < world.length; y++) { processedWorld.push(blankRow); } It pushes the blank row full of zeroes (the horizontal axis) then pumps that into the destination array (processedWorld, the vertical axis) What am I screwing up P.S. "world" is a different array from "processedWorld" and has already been defined, and works perfectly.
  14. Well, sorry guys! I've changed my entire system 😕 No longer doing color based collision detection, I am rather doing a more conventional system with a genuine tilemap, which is then translated into canvas visual output. Thanks for all of the support, though! I hope someone in the future finds this helpful!