Search the Community

Showing results for tags 'crash-and-burn'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Platform
    • Coding and Game Design
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Hey guys, I'm having an odd issue. I'm trying to automatically generate a map. Here, I'm going to show the code, and then explain what happens when I run it: // This is another class and defines a room in the game Room: function(x, y, w, h) { this.x1 = x; this.y1 = y; this.x2 = x + w; this.y2 = y + h; }, // Used to create rooms (a rectangle of non-blocked tiles) on the map // SOMETHING HERE IS CRASHING createRoom: function(room) { for (var x = room.x1; x < room.x2; x=+32) { for (var y = room.y1; y < room.y2; y=+32){ // change the "true" to "false" after collision is worked out this.map.push(new this.Tile(x, y, true, true)); } } },(I'm sorry, I know this code isn't pretty) Okay, so, as you can see, a room is really just a coordinate-defined rectangle. The "map" is an array that stores "Tiles" which are coordinate-defined tiles. Whew, does that make sense? I need to go back to school for sure. Now, that for statement, I'm going to use an example: We'll assume that room.x1 = 32, ".x2 = 96, ".y1 = 32, ".y2 =96. Nice and easy. (1) In the first for statement: if 32 is less than 96; it is, so we change 32 to 64 and move on (2) In the 2nd for statement: if 32 is less than 96; it is, so we change 32 to 64 and move on (3) We append a tile to the map array with coords (64, 64), and go back to the beginning (5) In the next pass we append a tile with coords (96, 96), and go back to the beginning (6) The for statement no longer applies, so it stops. This should only run 3 times right? But it's running indefinitely and crashing my browser. Any ideas?