LuisM

Members
  • Content Count

    15
  • Joined

  • Last visited

About LuisM

  • Rank
    Member

Recent Profile Visitors

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

  1. LuisM

    A hint!

    Thank you. @onlycape I'm doing something I need to collect items and did not want to make a group for each item plus a single clip and put different types inside but give up! I'll let each group be the type of items so it gets better. about your tip I do not know where I would use this my knowledge of javascript is low. but that's how my group looks. gStones= game.add.group(); game.physics.p2.enable(gStones); gStones.enableBody = true; gStones.physicsBodyType = Phaser.Physics.P2JS; gStones.create(320, 510, 'stone1').scale.setTo(0.7); gStones.create(520, 710, 'stone2').scale.setTo(0.7); gStones.create(720, 310, 'stone3').scale.setTo(0.7); gStones.setAll('body.kinematic', true); just in case I need to give types to each item in a group can I explain where and how to use it?
  2. LuisM

    A hint!

    I'm making a game with some collectible objects. I created a group for each type of object so I know what type is the object I collected. but I'm in need of a hint how I can arrange this! I already have 6 groups. and each group has 4 to 7 items that are scattered throughout the scene. would you have a better way to do that? thanks!
  3. I do not find the error in this code anyone help me please. I'm doing a topdown game but I can not get the camera to follow the sprite player.... Sorry if I'm doing something wrong! this.Camera.follow (player, Phaser.Camera.FOLLOW_TOPDOWN); this does not work ! do not open anything; When I remove it everything works normal var config = { type: Phaser.CANVAS, width: 1920, height: 1080, physics: { default: 'arcade', acarde:{ //gravity:{ } debug: false } }, scene: { preload: preload, create: create, update: update } }; var game = new Phaser.Game(config); function preload () { this.load.image('ground', 'images/ground-smart.png'); //pedras this.load.image('stone1', 'images/stone-1.png'); this.load.image('stone5', 'images/stone-5.png'); //flores this.load.image('flor1', 'images/flor1.png'); this.load.image('flor2', 'images/flor2.png'); this.load.image('flor3', 'images/flor3.png'); //player this.load.spritesheet('player1', 'images/p-anim.png', { frameWidth: 128, frameHeight: 90 }); } function create () { this.add.image(960, 540, 'ground'); this.add.image(64, 430, 'stone1'); this.add.image(650, 80, 'stone5'); flores = this.physics.add.staticGroup(); flores.create(400, 350, 'flor1'); flores.create(220, 90, 'flor3'); player = this.physics.add.sprite(400, 300, 'player1'); this.Camera.follow(player, Phaser.Camera.FOLLOW_TOPDOWN); this.anims.create({ key: 'left', frames: this.anims.generateFrameNumbers('player1', { start: 1, end: 7 }), frameRate: 6, repeat: -1 }); this.anims.create({ key: 'turn', frames: [ { key: 'player1', frame: 0 } ], frameRate: 20 }); this.anims.create({ key: 'right', frames: this.anims.generateFrameNumbers('player1', { start: 1, end: 7 }), frameRate: 10, repeat: -1 }); cursors = this.input.keyboard.createCursorKeys(); this.physics.add.collider (player, flores); } function update () { if (cursors.up.isDown) { player.setVelocityY(-160); player.anims.play('left', true); } else if (cursors.down.isDown) { player.setVelocityY(160); player.anims.play('right', true); } else { player.setVelocityX(0); player.anims.play('turn'); } if (cursors.up.isDown && player.body.touching.down) { player.setVelocityY(-330); } }
  4. I researched before and found nothing! I care a model for my scene only that the model is very wet say. very smooth! I would like to set this up in babylonjs?
  5. LuisM

    Help-me

    Thank you ! really was going too fast. I do not have a deadline.
  6. LuisM

    Help-me

    Sorry for being immature! You're right, I will do as you say Thank you xD.
  7. LuisM

    Help-me

    Yes I will study more about events. Thank you for answering! I decide to learn javascript. already I can do some things and know how to work more or less this language. after your help I realized I need to learn more about some javascript things and then start using babylonjs. My intention was to create a control script! I want to make a game and I do not quite know how to add controlle a character with animations. as walking, running, etc. alone so get this. <body> <canvas id="renderCanvas"></canvas> <script type="text/javascript"> var canvas = document.querySelector("#renderCanvas"); var engine = new BABYLON.Engine(canvas, true); var createScene = function () { var scene = new BABYLON.Scene(engine); var camera = new BABYLON.FreeCamera("camera1", new BABYLON.Vector3(0, 25, -10), scene); camera.setTarget(BABYLON.Vector3.Zero()); camera.attachControl(canvas, false); var light = new BABYLON.HemisphericLight("light1", new BABYLON.Vector3(0, 1, 0), scene); light.intensity = .5; BABYLON.SceneLoader.ImportMesh("", "assets/", "wall-chao.babylon", scene, function(newMeshes) { chaodeleg = newMeshes[0]; chaodeleg.position.y = 1; chaodeleg.material = materialChao; }); BABYLON.SceneLoader.ImportMesh("", "assets/", "wall-deleg.babylon", scene, function(newMeshes) { walldeleg = newMeshes[0]; walldeleg.position.y = 2; }); var materialChao = new BABYLON.StandardMaterial("texture1", scene); materialChao.diffuseColor = new BABYLON.Color3(1.0, 0.2, 0.7); BABYLON.SceneLoader.ImportMesh("", "assets/", "player.babylon", scene, function(newMeshes) { Character1 = newMeshes[0]; Character1.position.y = 4; }); var moveLeft = false, moveRight = false; var moveFrente = false, moveTras = false; var onKeyDown = function(e){ var code = e.keyCode; switch (code) { case 65: moveLeft = true; moveRight = false; break; case 68: moveLeft = false; moveRight = true; break; case 87: moveFrente = true; moveTras = false; break; case 83: moveFrente = false; moveTras = true; break; } }; var onKeyUp = function(e){ if (e.keyCode == 65) { moveLeft = false; } else if (e.keyCode == 68) { moveRight = false; } else if (e.keyCode == 87) { moveFrente = false } }; switch } case break;*/ scene.registerBeforeRender(function() { if (moveLeft) { Character1.position.x -= .07; } else if (moveRight) { Character1.position.x += .07; } else if (moveFrente) { Character1.position.z += .07; } }); window.addEventListener("keydown", onKeyDown, false); // notice these falses window.addEventListener("keyup", onKeyUp, false); // notice these falses scene.onDispose = function () { window.removeEventListener("keydown", onKeyDown); window.removeEventListener("keyup", onKeyUp); }; return scene; }; var scene = createScene(); engine.runRenderLoop(function () { scene.render(); }); window.addEventListener("resize", function () { engine.resize(); }); </script> =================== This script! just have a problem can not cause it to identify when the letter 'W' and released as well as using the 'A' and 'D'.
  8. LuisM

    Help-me

    Our your code is better I will use! more about the browser steal focus or open bar to search by pressing a letter keeps happening! I test my direct application in firefox not use playgroundla all work well. more when you take the same code and saved in a index.html. in chrome 3d models do not appear in firefox and everything works very well, import functions. there examples in babylonjs.com to open normally when using keyboard firefox does not steal the focus or open the search bar. some of them even warns that one should press ESC to the mouse. THY xD
  9. LuisM

    Help-me

    Not solve it do not understand anything about the widnows.addEve... ou DOM ! I use this code.. var moveLeft = false, moveRight = false; window.addEventListener( "keydown", function(e){ if (e.keyCode == 65) { // A or Q65 || e.keyCode == 81 moveLeft =true; moveRight = false; } else if (e.keyCode == 68) { // D moveLeft = false; moveRight = true; } }); window.addEventListener("keyup", function(e) { if (e.keyCode == 65) { // A or Q || e.keyCode == 81 moveLeft = false; } else if (e.keyCode == 68) { // D moveRight = false; } }); scene.registerBeforeRender(function() { if (moveLeft) { Player.position.x -= .05; } else if (moveRight) { Payer.position.x += .05; } }); return scene; } var scene = createScene(); engine.runRenderLoop(function(){ scene.render(); }); // the canvas/window resize event handler window.addEventListener('resize', function(){ engine.resize(); }); }); </script> </body> </html> it moves up when I press the keys as defined want but. while the search bar of Firefox open taking the focus of the app. if anyone has any solution! THX.
  10. LuisM

    Help-me

    You see ! Thank you gave me a light xD as the false. it was an error when sending the message it n this in code. people like you generate more programmers. 3 days seeing javascript I still have a lot to learn. kkkkkk. learn a bit of python and c, and now I'm trying to learn javascript and babylon API. and their response is an incentive I'm kind of just going and doing comprising sorry and uncomfortable.
  11. LuisM

    Help-me

    Thanky you ! I do not understand very well but it has to do with this function.
  12. Wingnut - Thanks for answering. I was happy to read. but the problem was the Chrome browser for some reason I cared .babylon the file and 3d model does not appreciate then decide to use firefox and it was simply worked.
  13. LuisM

    Help-me

    Hello everyone ! I'm new to javascript. yet I have done some scenes in babylonjs! and I have two questions about I did a scene for training in order to better understand the babylonjs engine. and with this code: var moveLeft = false, moveRight = false; window.addEventListener("keydown", function(e) { if (e.keyCode == 65) { // A or Q65 || e.keyCode == 81 moveLeft =true; moveRight = false; } else if (e.keyCode == 68) { // D moveLeft = false; moveRight = true; } });//agora um negativo - como ta em escuta. window.addEventListener("keyup", function(e) { if (e.keyCode == 65) { // A or Q || e.keyCode == 81 moveLeft = false; } else if (e.keyCode == 68) { // D moveRight = false; } }); moves a cube and when it moves to the pressing example the letter 'A'. the browser takes this action as well and open a search bar like to know how do I that after charging a tight keys scene to be captured or something. sorry no idea how to do it. the second question, stupid means someone here already developing a game or something and published for android? how did you do it ? phonegap? what is the best way?
  14. I just've seen several posts here that shows how to do this more never works for me to decide to ask for help. I just want to learn how to import files not there is nothing very clear about it all the codes I found after two days of searching failed. maybe someone here can help me. my code. <! DOCTYPE html> <Html> <Head> <Meta charset = utf-8> <Title> My first Babylon.js app </ title> <Style> html, body { overflow: hidden; width: 100%; height: 100%; margin: 0; padding: 0; } renderCanvas { width: 100%; height: 100%; touch-action: none; } </ Style> </ Head> <Body> <Script src = 'babylon.2.5.js'> </ script> <! - <script src = 'http://www.babylonjs.com/hand.minified-1.2.js'> </ script> -> <Canvas id = 'renderCanvas'> </ canvas> <Script> window.addEventListener ( 'DOMContentLoaded', function () { // get the DOM element canvas var canvas = document.getElementById ( 'renderCanvas'); // load the 3D engine var = new engine BABYLON.Engine (canvas, true); // function createScene que Creates and return the scene var createScene = function () { // create a basic object BJS Scene var = new scene BABYLON.Scene (engine); //scene.clearColor = new BABYLON.Color3 (10,22,10); // create a Freecamera, And Set to its position (x: 0, y 5, z -10) Camera = new BABYLON.FreeCamera var ( 'CAMERA1' new BABYLON.Vector3 (0, 5, -10), scene); // target camera to the scene origin camera.setTarget (BABYLON.Vector3.Zero ()); // attach the camera to the canvas camera.attachControl (canvas, false); // create a basic light, aiming 0,1,0 - meaning, to the sky var = new light BABYLON.HemisphericLight ( 'light1' new BABYLON.Vector3 (0,1,0) scene); // create a built-in 'sphere' shape; its constructor takes 5 params: name, width, depth, subdivisions, scene var = BABYLON.Mesh.CreateSphere sphere ( 'sphere1', 16, 1, scene); // // the sphere moves upward half of its height sphere.position.x = -2; // var box = BABYLON.Mesh.CreateBox ( 'box', 1.0, scene, false, BABYLON.Mesh.DEFAULTSIDE); //box.rotation.y = -10; // create a built-in 'ground' shape; its constructor takes the same 5 params the sphere's the one BABYLON.SceneLoader.ImportMesh ( '', 'model /' '01.babylon' scene, function (meshes) { var meshes m = [0]; = //m.isVisible; m.scaling new BABYLON.Vector3 = (2,2,2); TOAD_MODEL = m; }); var = BABYLON.Mesh.CreateGround ground ( 'ground1', 6, 6, 2, scene); // return the created scene return scene; } // call the function createScene var = createScene scene (); // run the loop surrender engine.runRenderLoop (function () { scene.render (); }); // the canvas / window resize event handler window.addEventListener ( 'resize', function () { engine.resize (); }); }); </ Script> </ Body> </ Html> --- The ball appears the ground too light and more etc 3d model that matter try does not work.