• Content Count

  • Joined

  • Last visited

  1. Currently, you're trying to access arrays that do not exist. Using positions1.x[randNum], you are trying to find an property of positions1 that does not exist (x). Your current code would work if var positions1 = { x: [100, 300, 500], y: [60, 60, 60] } The way in which I would do this would be to set positions1 equal to [[100, 60], [300, 60], [500, 60]] (var positions1 = [[100, 60], [300, 60], [500, 60]];) to use nested arrays. Then, you could access a random set of coordinates with let randPos = positions1[Math.floor(Math.random() * 3)]; and set the coordinates of the sprite to the respective x and y values with strawberry.x = randPos[0]; strawberry.y = randPos[1]]; What this does is set randPos equal to one of the nested arrays in the positions1 array, giving it a value of [100, 60], [300, 60], or [500, 60]. Then you can access the first or second element said array.
  2. I've started developing a small website located at https://llamatrauma.000webhostapp.com/ that pulls together a bunch of projects I've made on Khan Academy over the years that I've used it. Before I go any further, I was hoping to get input from more experienced devs about whether or not a website like mine would be self-sufficient, assuming the cost of upkeep would be around $4 a month. I would most likely use Google AdSense to create revenue, assuming I got any traffic. Thanks for any input!
  3. Thanks for the help! That fixed the scaling, and I realized that I had been calling the game loop incorrectly, which fixed the rendering problem.
  4. Hello, I am looking into game design, and decided to use the Pixi.js library for a project. The problem is that I am self-taught and unfamiliar with using Pixi. I am trying to resize a renderer created by the Pixi.autoDetectRenderer() method, but doing so messes up a simple background that I have loaded. I believe that the problem has to do with the order in which the program loads, because depending on how I open the website, the canvas may appear blank. When I attempt to load the website without resizing the canvas, the background loads well (when it loads at all). Any help would be appreciated. The small file containing my source code is attached. I apologize in advance for my ignorance! javascriptSrc.txt