Search the Community

Showing results for tags 'solve'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • 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 4 results

  1. Hello again forum, I hope you have a great day I would like to continue my snake project game, and today i have decided to make a scoreboard for each fruits eaten. However i have an issue, i cannot display a UI text on my project even though i have followed tutorial in here The program seems to crash too and wont run. Any help given is appreciated. Cheers Here's my code, i insert the URL code into createScene function. <!DOCTYPE html> <html> <head> <title>Snake Game</title> <script src="babylon.js"></script> <script src="hand-1.3.7.js"></script> <script src="babylonObjLoader.js" ></script> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <canvas id="mycanvas"></canvas> <script> var canvas = document.getElementById("mycanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function() { var scene = new BABYLON.Scene(engine); var ground = BABYLON.Mesh.CreateGround("ground1", 100, 100, 100, scene); //var camera = new BABYLON.FreeCamera("camera2", new BABYLON.Vector3(0,5,-10), scene); /*var camera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(0, 1, -15), scene); scene.activeCamera = camera;scene.activeCamera.attachControl(canvas); scene.activeCamera.keysUp.push(87); */ var camera = new BABYLON.ArcRotateCamera("camera",0,0,0,BABYLON.Vector3.Zero(0,10,0), scene); //var camera = new BABYLON.TouchCamera("camera2", new BABYLON.Vector3(0, 10, 0), scene); //var camera = new BABYLON.GamepadCamera("camera2", new BABYLON.Vector3(0, 15, -45), scene); //var camera = new BABYLON.DeviceOrientationCamera("camera", new BABYLON.Vector3(0, 1, -15), scene); //var camera = new BABYLON.FollowCamera("camera2", new BABYLON.Vector3(0, 15, -45), scene); //camera.lockedTarget = model; //camera.setPosition(new BABYLON.Vector3(0,5,-10)); camera.setTarget(BABYLON.Vector3.Zero(),scene); camera.attachControl(canvas,false); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0,1,0), scene); light.intesity = 0.5; var body = BABYLON.MeshBuilder.CreatePolyhedron("body", {type: 10, size: 0.7},scene); var materialBody = new BABYLON.StandardMaterial("bodyMat",scene); materialBody.diffuseColor = new BABYLON.Color3(1,0,0); body.material = materialBody; body.position.y = 5; body.position.x = 50; body.rotation.x = Math.PI/4; body.rotation.z = .19; /*var head = BABYLON.Mesh.CreateBox("head",0.7,scene); var materialHead = new BABYLON.StandardMaterial("HeadMat",scene); materialHead.diffuseColor = new BABYLON.Color3(.5,.2,0.3); head.material = materialHead; head.position.x = -4.5; head.position.z = -3; head.position.y = 1; */ var canvas2 = new BABYLON.ScreenSpaceCanvas2D(scene, { id: "mycanvas", size: new BABYLON.Size(300, 100), backgroundFill: "#4040408F", backgroundRoundRadius: 50, children: [ new BABYLON.Text2D("Hello World!", { id: "text", marginAlignment: "h: center, v:center", fontName: "20pt Arial", }) ] }); var apple; BABYLON.SceneLoader.ImportMesh("","Finalproject/", "apple.obj", scene, function (meshes) { apple = meshes[0]; //apple.parent = sphere1; /*engine.runRenderLoop(function() { //scene.activeCamera.alpha += .01; apple.rotation.y +=0.1; scene.render(); }); */ }); var apple2; BABYLON.SceneLoader.ImportMesh("","Finalproject/", "apple.obj", scene, function (meshes) { apple2 = meshes[0]; apple2.position.x = 20; apple2.position.z = 20; }); /*var sphere1 = BABYLON.Mesh.CreateSphere("sphere1",1,1, scene); sphere1.position.y = 0.7; sphere1.material = myMaterial; var myMaterial = new BABYLON.StandardMaterial("myMaterial", scene); myMaterial.diffuseColor = new BABYLON.Color3(0, 1, 0); */ //sphere1.parent = apple; var snake ; BABYLON.SceneLoader.ImportMesh("","Finalproject/", "alphaSnake.babylon", scene, function (newMeshes, particleSystems, skeletons) { snake = newMeshes[0]; snake.position.y = 2; snake.rotation.z = -0.07; snake.rotation.y = 10; snake.rotation.x = 25; snake.position = new BABYLON.Vector3(10, 0, 0); //head.parent = snake; var isvisible = false; window.onkeyup = function(event) { event = event || window.event; var keyCode = event.which || event.keyCode; switch(keyCode) { // W key case 87: snake.rotation.y = Math.PI; snake.position.x -=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); break; // A Key case 65: snake.rotation.y = Math.PI/2; snake.position.z -=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); break; // S key case 83: snake.rotation.y = 25.5; snake.position.x +=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); break; // D key case 68: snake.rotation.y = -Math.PI/2; snake.position.z +=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); break; /*// E key case 69: if (snake.intersectsMesh(apple, false)) { isvisible = true; } break; */ // J key case 74: snake.rotation.y = Math.PI/2; break; // K key case 75: snake.rotation.y = 25.5; break; // L key case 76: snake.rotation.y = -Math.PI/2; break; // I key case 73: snake.rotation.y = Math.PI; break; } }; scene.registerBeforeRender(function(){ apple.rotation.y +=0.1; apple2.rotation.y +=0.1; if (snake.intersectsMesh(apple, false)) { apple.dispose(); } if (snake.intersectsMesh(apple2, false)) { apple2.dispose(); } /*if(isvisible == true) { apple.dispose(); } */ /*sphere1.scaling.x = 5; sphere1.scaling.y = 5; sphere1.scaling.z = 5; sphere1.position.y = 2.5; sphere1.material = myMaterial; apple.scaling.x = 0; apple.scaling.y = 0; apple.scaling.y = 0; */ }); }); return scene; }; var scene = createScene(); engine.runRenderLoop(function() { //scene.activeCamera.alpha += .01; /* if(isvisible == true) { sphere1.scaling.x = 0; } */ scene.render(); }); window.addEventListener("resize",function(){ engine.resize(); }); </script> </body> </html>
  2. Hi Forum, First of all, i tried to create a snake game for my project, however i have encountered some difficulties. I can't make the apple dissapear upon contact / collision with the snake. I can make the object dissapear normally if its just mesh from babylon ( sphere, box, etc ) . However, when i tried to do the same to imported blender object, it doesnt work, Any ideas? Any Help given is greatly appreciated. Thank you here's my code : P.S : i tried to upload it to playground, but it seems not working, as my snake and apple are on different file, and i dont know how to upload them in playground. <!DOCTYPE html> <html> <head> <title>Snake Game</title> <script src="babylon.js"></script> <script src="hand-1.3.7.js"></script> <script src="babylonObjLoader.js" ></script> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <canvas id="mycanvas"></canvas> <script> var canvas = document.getElementById("mycanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function() { var scene = new BABYLON.Scene(engine); var ground = BABYLON.Mesh.CreateGround("ground1", 100, 100, 100, scene); //var camera = new BABYLON.FreeCamera("camera2", new BABYLON.Vector3(0,5,-10), scene); /*var camera = new BABYLON.FreeCamera("FreeCamera", new BABYLON.Vector3(0, 1, -15), scene); scene.activeCamera = camera;scene.activeCamera.attachControl(canvas); scene.activeCamera.keysUp.push(87); */ var camera = new BABYLON.ArcRotateCamera("camera",0,0,0,BABYLON.Vector3.Zero(0,10,0), scene); //var camera = new BABYLON.TouchCamera("camera2", new BABYLON.Vector3(0, 10, 0), scene); //var camera = new BABYLON.GamepadCamera("camera2", new BABYLON.Vector3(0, 15, -45), scene); //var camera = new BABYLON.DeviceOrientationCamera("camera", new BABYLON.Vector3(0, 1, -15), scene); //var camera = new BABYLON.FollowCamera("camera2", new BABYLON.Vector3(0, 15, -45), scene); //camera.lockedTarget = model; //camera.setPosition(new BABYLON.Vector3(0,5,-10)); camera.setTarget(BABYLON.Vector3.Zero(),scene); camera.attachControl(canvas,false); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0,1,0), scene); light.intesity = 0.5; var body = BABYLON.MeshBuilder.CreatePolyhedron("body", {type: 10, size: 0.7},scene); var materialBody = new BABYLON.StandardMaterial("bodyMat",scene); materialBody.diffuseColor = new BABYLON.Color3(1,0,0); body.material = materialBody; body.position.y = 5; body.position.x = -50; body.rotation.x = Math.PI/4; body.rotation.z = .19; var head = BABYLON.Mesh.CreateBox("head",0.7,scene); var materialHead = new BABYLON.StandardMaterial("HeadMat",scene); materialHead.diffuseColor = new BABYLON.Color3(.5,.2,0.3); head.material = materialHead; head.position.x = -4.5; head.position.z = -3; head.position.y = 1; var apple; BABYLON.SceneLoader.ImportMesh("","Finalproject/", "apple1.obj", scene, function (meshes) { apple = meshes[0]; apple.parent = sphere1; /*engine.runRenderLoop(function() { //scene.activeCamera.alpha += .01; apple.rotation.y +=0.1; scene.render(); }); */ }); /*var sphere1 = BABYLON.Mesh.CreateSphere("sphere1",1,1, scene); sphere1.position.y = 0.7; sphere1.material = myMaterial; var myMaterial = new BABYLON.StandardMaterial("myMaterial", scene); myMaterial.diffuseColor = new BABYLON.Color3(0, 1, 0); */ //sphere1.parent = apple; var snake ; BABYLON.SceneLoader.ImportMesh("","Finalproject/", "alphaSnake.babylon", scene, function (newMeshes, particleSystems, skeletons) { snake = newMeshes[0]; snake.position.y = 2; snake.rotation.z = -0.07; snake.rotation.y = 10; snake.rotation.x = 25; snake.position = new BABYLON.Vector3(0, 0, 0); head.parent = snake; var isvisible = false; window.onkeyup = function(event) { event = event || window.event; var keyCode = event.which || event.keyCode; switch(keyCode) { // W key case 87: snake.position.x +=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); if (head.intersectsMesh(apple, false)) { isvisible = true; } break; // A Key case 65: snake.position.z +=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); break; // S key case 83: snake.position.x -=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); break; // D key case 68: snake.position.z -=3; //scene.beginAnimation(skeletons[0], 0, 60, true, 1.0); break; } }; scene.registerBeforeRender(function(){ if(isvisible == true) { apple.dispose(); /*sphere1.scaling.x = 5; sphere1.scaling.y = 5; sphere1.scaling.z = 5; sphere1.position.y = 2.5; sphere1.material = myMaterial; apple.scaling.x = 0; apple.scaling.y = 0; apple.scaling.y = 0; */ } }); }); return scene; }; var scene = createScene(); engine.runRenderLoop(function() { //scene.activeCamera.alpha += .01; /* if(isvisible == true) { sphere1.scaling.x = 0; } */ scene.render(); }); window.addEventListener("resize",function(){ engine.resize(); }); </script> </body> </html>
  3. The link http://www.askforgametask.com/mobile/games/matchsticks/ Description Matchsticks: Endless Digit Hunter is an HTML5 one-button matchstick (aka toothpick) puzzle/logic game in which your goal is to rearrange all given math equations and make them true by moving just one match. The game can be played on 4 different levels of difficulty: Normal - the equations contain numbers from 0 to 9. Medium - the equations contain numbers from 0 to 19. Hard - the equations contain numbers from 0 to 49. Insane - the equations contain numbers from 0 to 99. On each level there are 5 faulty math equations which must be corrected as fast as possible! All equations are procedurally generated so the levels are always different. To make the given equation true, tap on a match and move it to the right place. For each bad move you get a penatly of 10 seconds! The game can help you to improve your math skills. You can run it on your desktop or mobile browser. Screenshots
  4. el_scrambone

    [WIP] Get The Brains

    Description: HTML5 physics game about sad zombie. 20 nice levels you need to solve! mobile-friendly game. Author: el_scrambone Genre: Arcade, Puzzle, Physics Game Dimensions: 720 x 1,080 pixels Game Link: http://bap3.pe.hu/ If you have some questions or tips - go and tell it to me) will be glad to get some feedbacks! Screenshots: Video Trailer: