Search the Community

Showing results for tags 'random'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • 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


Last Updated

  • Start


Filter by number of...


  • Start



Website URL





Found 28 results

  1. titmael

    Random world rendering

    Hi, I know different ways to generate random worlds or mazes in JS but go a question about the render of those worlds : what is the better way to load a randomly generated world in javascript (array, 2D array or why not JSON) ? Loops, tilemaps ... ? I never used that kind of world in my Phaser games, so I wonder what's the best way to do it, to be efficient when rendering and modifying (digging for example). Thx
  2. PixelRobot

    Man vs. Robots

    I made a little HTML5 game. It's a randomly generated turn-based puzzle game about surviving the attack of killer robots. There's a randomly gneerated board where you'll see a man and some robots. You can move the man to any of the squares near him. Clicking on the man will dangerously teleport him to a random location. Teleporting may cause instant dead, so be careful with that. You can't attack the robots directly, but you can make the robots crash into each other. You win by making all the robots die. You lose if a robot gets to the square the man is in. Once you clean a level you move to a next level, where you'll fight one more robot than before. Eventually you will die. Note: Sometimes the game doesn't fully load the first time. Reloading the page usually works.
  3. I just whipped up another quick example for Metrix.js this time it shows you how to build a controllable player on a randomly generated heightmap with first person controls. You can try out the example here 0.3 - First Person Controls on HeightMap heres what the random terrain in the example looks like(for the lazy) and heres the source, requires three.js( and Metrix.js( <!DOCTYPE html><html lang="en"><head> <script src="three.min.js"></script> <script src="Metrix0.3.js"></script> <script> var mouseLocked = false; var user,fpsControls; var terrainMap,terrainMesh; Metrix.WorldOptions.Gravity = 3; window.onload = function() { Metrix.Initialize(); }; Metrix.OnLoad = function() { var txt = new MUI.Element("span",document.body); txt.SetHTML("click anywhere to start");,10,0); user = new Metrix.Object(,{velocity: true, slope: {start: 0.3}, collisions: true, gravity: true, mass: 30, drag: 2, bounds: {aabb: new Metrix.AABB(null,new THREE.Vector3(0.5,2,0.5),0,-1,0)}});//Create Metrix.Object to control velocity, collisions and gravity of the player user.AddUpdateCallback(userUpdate); fpsControls = new Metrix.FirstPersonController(,1,1);//Add a first person controller to control yaw, pitch and look sensitivity terrainMap = new Metrix.HeightMap(new THREE.Vector3(0,0,0),1,Utils.GenerateHeightMap(1,20,-10,40,40,true));//Create a new height map thats randomly generated using Metrix.js's Utils.GenerateHeightMap(maxRandomClimb,maxHeight,minHeight,smooth,smoothingAmount) terrainMesh = terrainMap.GenerateMesh(new THREE.MeshPhongMaterial({color: 0x20af30, specular: 0x202020, shininess: 20, ambient: 0x109f20}));//Generate a THREE.Mesh from the height map Metrix.AddHeightMap(terrainMap);//Add the terrain to the metrix world var sun = new THREE.SpotLight(0xfafafa,1.5,0,-2); sun.position.set(40,100,90); Metrix.scene.add(terrainMesh); Metrix.scene.add(new THREE.AmbientLight(0x303030)); Metrix.scene.add(sun); window.addEventListener("click",function() { if (!mouseLocked) { Metrix.LockMouse(mouseMove,mouseExit);//If mouse isnt locked and mouse clicked, lock mouse Metrix.AddObject(user);//Unpause be adding user back to the metrix world } mouseLocked = true; }); Metrix.Go();//Start Metrix.js game loop }; function userUpdate() { if (Metrix.Key[KEY_W]) {//If W key down, move forward user.MoveForward(1); } if (Metrix.Key[KEY_D]) {//If D key down, move right user.MoveRight(1); } if (Metrix.Key[KEY_S]) {//If S key down, move backward user.MoveForward(-1); } if (Metrix.Key[KEY_A]) {//If A key down, move left user.MoveRight(-1); } if (Metrix.Key[KEY_SPACE] && user.Grounded()) {//If SPACE key down and user is on ground, jump user.velocity.y = 35; } } function mouseMove(mX,mY) { fpsControls.Look(-mX,-mY);//Look around, mX = mouse movement x, mY = mouse movement y } function mouseExit() { mouseLocked = false; Metrix.RemoveObject(user);//Remove user to pause the game once mouse lock is cancelled } </script></head><body></body></html>