Jump to content

Search the Community

Showing results for tags 'typeError'.

  • 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 Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

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 16 results

  1. I need to get frustum planes, but I'm getting getTransformationMatrix error: camera.getTranformationMatrix is not a function Playground: http://playground.babylonjs.com/ts.html#Y0A6Y7 But it does work with my older local babylon.custom.js. I want to use a newer version that will support BABYLON.VideoRecorder. I hope there's an easy way to have both BABYLON.VideoRecorder and frustum planes. Thanks, Joe
  2. Hi, I'm a relative noob to javascript and Phaser, and I'm having an issue coding my first proper game. I'm using Phaser version 2.6.2 and the latest version of Chrome browser. I'm asking the user a basic maths question, but when I draw the buttons for the user to click they appear but aren't clickable. Here is the console error: And here is the code I believe to be causing the error: game.add.button(50, 250 + i * 75, "buttons", this.checkAnswer).frame = i; And there is also this bit of code to draw the button mask: this.buttonMask = game.add.graphics(50, 250); this.buttonMask.beginFill(0xffffff); this.buttonMask.drawRect(0, 0, 400, 200); this.buttonMask.endFill(); numberTimer.mask = this.buttonMask; Any help would be appreciated, if you need any extra information to help me I'll gladly provide it. Been staring at this problem for over a week and I just can't figure out what's wrong, I hope it's something simple I'm doing wrong. Thanks
  3. Hi, I am trying to make a simple game and have been running into many problems. The problem I am facing now is that I cannot fix this error in my javascript. It says that it cannot read the 'setSize' property on my 'player' sprite, but it works perfectly fine on my other sprites. Next it says that it cannot read the 'velocity' property of the 'player' sprite, but when I comment out the 'setSize' property it works. I just cannot figure out what is wrong, have I misspelled something? I cannot seem to find the problem, so any help would be appreciated. Btw, it worked yesterday, but when I loaded it up today it was no longer working... Html: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Simple Canvas Game</title> <link href="https://fonts.googleapis.com/css?family=Syncopate:700" rel="stylesheet"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <style> html { background: black } canvas { margin: auto; } h1 { font-family: 'Syncopate', sans-serif; color: rgb(194, 68, 91); text-align: center; margin: 0 auto; font-size: 25px; } h2 { color: white; font-size: 8px; font-family: 'Syncopate', sans-serif; } </style> </head> <body> <header> <h1>Crafty Heroes</h1> </header> <footer> <h2>&copy; SoulesteDesigns 2017</h2> </footer> <script src="phaser.js"></script> <script src="game.js"></script> </body> </html> game.js: // VARIABLES // variables for static objects var walls; var house; var gate; var gate2; // variables for character var cursors; var player; var left; var right; var up; var down; var game = new Phaser.Game(550, 540, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); // ADD HOUSES function addHouse(image) { house = game.add.physicsGroup(); house.create(-250, -240, 'greenhouse'); house.setAll('body.immovable', true); } // ADD FENCES OR WALLS function addWalls(image) { walls = game.add.physicsGroup(); // fences up top walls.create(-90, -200, 'fencefront'); walls.create(5, -200, 'fencefront'); walls.create(100, -200, 'fencefront'); walls.create(195, -200, 'fencefront'); // fences to right walls.create(288, -200, 'fenceright'); walls.create(288, -135, 'fenceright'); walls.create(288, -70, 'fenceright'); walls.create(288, -5, 'fenceright'); // fences at bottom walls.create(5, 59, 'fencefront'); walls.create(100, 59, 'fencefront'); walls.create(195, 59, 'fencefront'); // fences to left walls.create(-91, -200, 'fenceleft'); walls.create(-91, -135, 'fenceleft'); // set the walls to be static walls.setAll('body.immovable', true); } // PRELOAD IMAGES FOR ITEMS, PLAYERS, ETC. function preload() { // preload player game.load.spritesheet('player', 'hero.png', 64, 64); // preload houses game.load.image('greenhouse', 'greenhouse.png'); // preload fences game.load.image('fencefront', 'fencefront.png'); game.load.image('fenceleft', 'fenceleft.png'); game.load.image('fenceright', 'fenceright.png'); // fence that has adjusted hit boundary game.load.image('gate', 'fenceleft.png'); game.load.image('gate2', 'fencefront.png'); // preload ground game.load.image('ground', 'tiles2.png'); } // ADD THINGS TO GAME function create() { // set area that the player may travel to game.world.setBounds(-250, -250, 550, 550); // set background color game.stage.backgroundColor = ('#3c6f42'); gate = game.add.physicsGroup(); game.physics.startSystem(Phaser.Physics.ARCADE); gate = game.add.sprite(-91, -70, 'gate'); gate.name = 'gate'; game.physics.enable([gate], Phaser.Physics.ARCADE); // This adjusts the collision body size to be a 100x50 box. // 50, 25 is the X and Y offset of the newly sized box. gate.body.setSize(15, 90, -2, 3); gate.body.immovable = true; gate2 = game.add.physicsGroup(); game.physics.startSystem(Phaser.Physics.ARCADE); gate2 = game.add.sprite(-90, 59, 'gate2'); gate2.name = 'gate2'; game.physics.enable([gate2], Phaser.Physics.ARCADE); // This adjusts the collision body size to be a 100x50 box. // 50, 25 is the X and Y offset of the newly sized box. gate2.body.setSize(90, 15, 3, 3); gate2.body.immovable = true; // adding the ground var ground = game.add.sprite(-224, -100, 'ground', 1); var ground = game.add.sprite(-224, -60, 'ground', 1); var ground = game.add.sprite(-224, -20, 'ground', 1); var ground = game.add.sprite(-224, 20, 'ground', 1); var ground = game.add.sprite(-184, 20, 'ground', 1); var ground = game.add.sprite(-144, 20, 'ground', 1); // add player image and place in screen player = game.add.sprite(-232, -100, 'player'); player.smoothed = true; player.scale.set(.9); player.body.setSize(30, 40, 16, 16); player.body.immovable = false; // player will "collide" with certain images like walls and houses player.collideWorldBounds = true; // ANIMATION FOR PLAYER CONTROLS down = player.animations.add('down', [0,1,2,3], 10, true); left = player.animations.add('left', [4,5,6,7], 10, true); right = player.animations.add('right', [8,9,10,11], 10, true); up = player.animations.add('up', [12,13,14,15], 10, true); // enable physics in the game (can't go through walls, gravity, etc.) game.physics.enable([player, house, walls, gate], Phaser.Physics.ARCADE); game.physics.startSystem(Phaser.Physics.P2JS); game.physics.startSystem(Phaser.Physics.ARCADE); game.physics.p2.enable(player); // make sure to add this code to add items/walls/buildings addHouse(); addWalls(); // enable keyboard arrows for controls cursors = game.input.keyboard.createCursorKeys(); // camera will follow the character game.camera.follow(player); } // what happens when player does something function update() { // player will now collide with these images rather than pass over them game.physics.arcade.collide(player, house); game.physics.arcade.collide(player, walls); // PLAYER CONTROLS player.body.velocity.set(0); // player presses left key if (cursors.left.isDown) { player.body.velocity.x = -100; player.play('left'); } // player presses right key else if (cursors.right.isDown) { player.body.velocity.x = 100; player.play('right'); } // player presses up key else if (cursors.up.isDown) { player.body.velocity.y = -100; player.play('up'); } // player presses down key else if (cursors.down.isDown) { player.body.velocity.y = 100; player.play('down'); } // player does not press anything else { player.animations.stop(); } } function render() { game.debug.bodyInfo(gate2, 32, 32); game.debug.body(gate2); game.debug.bodyInfo(player, 32, 32); game.debug.body(player); }
  4. Hello my dear friends, I am trying to add animation to my bird object and I added for normal flying and It worked but when I try to add any other animation to same object it gives an error can you help me, I am adding my codes and the error message here, thanks! create: function() { this.bird = game.add.sprite(150, 200, 'bird'); this.bird.scale.setTo(0.1, 0.1); this.game.physics.arcade.enable(this.bird); this.bird.body.gravity.y = 1000; this.bird.animations.add('right', [0, 1], 5, true); this.bird.animations.add('dead', [2, 3], 5, true); this.bird.anchor.setTo(-0.2, 0.5); var spaceKey = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); spaceKey.onDown.add(this.fly, this); }, update: function() { this.game.physics.arcade.overlap(this.bird, this.blocks, this.killBird); }, fly: function() { if (this.bird.alive == false) return; this.bird.body.velocity.y = -325; var animation = game.add.tween(this.bird); animation.to({angle: -20}, 100); animation.start(); this.bird.animations.play('right'); }, killBird: function() { this.bird.animations.play('dead', 8, true); game.state.start('menu'); }, And I add the error message, and also my other problem is about pixel reformatting errors, how can I get rid of them, thanks.
  5. Hi everyone. I'm creating a game and I was testing it into different browsers. I always use Chrome for my tests and everything is fine there. I tried on Edge and it works perfect as in Chrome. Then I opened it in Firefox and there's a problem. It opens the preloader, the mainMenu page in which there is the name of the game and two buttons, but as I try to click on the "play" button, which brings me to the actual game, I have no answers. When I open the page I get these messages in firefox console log: I think the WebGL error is a Phaser one, because I use CANVAS in my game: (in index.html) var game = new Phaser.Game(800, 600, Phaser.CANVAS,''); And I guess that the "mozHidden" etc line is just a warning. So that TypeError must be the issue. What is the problem with those lines? What am I doing wrong with the instantiation of my game? Is it a problem that I use prototypes for my game like: (in Level1.js) Game.Level1 = function(game) { }; Game.Level1.prototype = { preload:function(game){ //... }, create:function(game){ //... } }; ? Oh, and I tried opening the game in the Firefox safe-mode, without the additional plug-ins, and it works like it should be. Any help would be really appreciated! Thank you very much. EDIT I tried deleting the cache on Chrome and Edge and it doesn't work immediately even there, giving me some phaser errors like the ones before. But no error about my code. And if I refresh the page several times, like 4 or 5 or more, it begins working again like it should. What could this problem be due to?
  6. Hello all, I'm trying to programmatically create a cylinder using the following: var cylinder = BABYLON.MeshBuilder.CreateCylinder("wormhole", {diameter: 1, tessellation: 24}, this.resourceStore["GameScene"]); cylinder.position = BABYLON.Vector3(-0.56, 1.27, 1.235); and it is throwing a TypeError: e is undefined with the following trace: o</i.prototype.copyFrom() babylon-2.4.min.js:1 t</i.prototype.computeWorldMatrix() babylon-2.4.min.js:6 o</i.prototype._evaluateActiveMeshes() babylon-2.4.min.js:10 o</i.prototype._renderForCamera() babylon-2.4.min.js:11 o</i.prototype._processSubCameras() babylon-2.4.min.js:11 o</i.prototype.render() babylon-2.4.min.js:11 GameManager.prototype.initialize/</textTask.onSuccess</<() GameManager.js:191 bound () self-hosted c</o.prototype._renderLoop() babylon-2.4.min.js:4 bound () self-hosted Any ideas? Everything works fine (i.e. scene loads, textures show, materials work, controls work). I have noticed lately that my textures seem to disappear at a particular camera but the geometry is still there. Not sure if its related.
  7. I am getting the following gamepad exception. babylon.max.js:39351 Uncaught TypeError: this.babylonGamepads[i].update is not a function Gamepads._checkGamepadsStatus @ babylon.max.js:39351 Gamepads._startMonitoringGamepads @ babylon.max.js:39340 Gamepads._onGamepadConnected @ babylon.max.js:39304 Gamepads._onGamepadConnectedEvent @ babylon.max.js:39276 For purposes of what I am doing, while I do have a gamepad connected on my system, I could care less about gamepad features. I do not use a game pad at all for this. That I know of, this just recently started happening, or is intermittent, with the one or two couple of version(s).
  8. Hi guys, I'm having troubles drawing some lines out of a Vector3 array with MeshBuilder.CreateLines / Mesh.CreateLines.. I've seen many examples of drawing lines in various playgrounds e.g. http://www.babylonjs-playground.com/#1DKDYG#0 - http://www.babylonjs-playground.com/#RF9W9 However, when I try to use these examples in my environment I get the following error: Uncaught TypeError: Cannot set property isPickable of #<i> which has only a getter i @ babylon.2.3.js:5 r @ babylon.2.3.js:10 i @ babylon.2.3.js:18 createScene @ LineScene.js:93 <- my awesome babylon scene :P I was not able to reproduce this error in the playground, the part of my code which causes the error: .. // shape var shape = [ new BABYLON.Vector3(1, 0, 0), new BABYLON.Vector3(0.2, 0.3, 0), new BABYLON.Vector3(0, 1, 0), new BABYLON.Vector3(-0.2, 0.3, 0), new BABYLON.Vector3(-1, 0, 0), new BABYLON.Vector3(-0.2, -0.3, 0), new BABYLON.Vector3(0, -1, 0), new BABYLON.Vector3(0.2, -0.3, 0), ]; shape.push(shape[0]); //this doesn't work var shapeline = BABYLON.MeshBuilder.CreateLines("sl", {points: shape}, scene); //neither does this //var shapeline = BABYLON.Mesh.CreateLines("sl", shape, scene); .. The rest of the code is only the creation of a simple scene from the very basic Babylon getting started tutorial and is working fine when I remove the CreateLines. Any ideas what I'm doing wrong? Cheers, Lesterhaus
  9. Wow, I cannot get past this error. What is causing this?
  10. Hey, I currently develop a simple game with Phaser and Javascript for a student project . I have added a "start screen" and now an error message "TypeError: an is undefined" pops up by calling the first state . It's located in the file "phaser. min. js". I already have tried to exchange this by another "phaser. min. js" file, but it still gets the mistake. Does somebody know advice? The attached file contains the js code of the first state. state1.txt
  11. I'm working on a game and need help with an error (Uncaught TypeError: Cannot set property 'frame' of undefined) that appears when I run code inside a function. Here's the full game code, with the error at line 60: function getRandom(min, max) { return Math.floor((Math.random() * (max - (min - 1))) + min);}var game = new Phaser.Game(480, 360, Phaser.AUTO, '', { preload: preload, create: create, update: update });var colorPosition = [0, 1, 2, 3];function preload() { game.stage.disableVisibilityChange = true; game.stage.backgroundColor = '#393837'; game.load.image('collide', 'assets/collide.png'); game.load.spritesheet('bucket-front', 'assets/bucket-front.png', 112, 82, 4); game.load.spritesheet('square', 'assets/square.png', 20, 20, 4); game.load.image('arrow', 'assets/arrow.png'); game.load.spritesheet('bucket', 'assets/bucket.png', 112, 82, 4);}function create() { collide = game.add.sprite(0, 317, 'collide'); game.physics.enable(collide, Phaser.Physics.ARCADE); arrow = game.add.sprite(175, 230, 'arrow'); for (var x = 0; x < 4; x++) { this['bucket' + x] = game.add.sprite((x * 120) + 4, 278, 'bucket', x) } squares = game.add.group(); function addSquare() { square = squares.create((getRandom(0, 3) * 120 + 50), -20, 'square', getRandom(0, 3)); game.physics.enable(square, Phaser.Physics.ARCADE); square.body.velocity.y=100; } for (var x = 0; x < 4; x++) { this['bucketFront' + x] = game.add.sprite((x * 120) + 4, 278, 'bucket-front', x) } game.time.events.loop(Phaser.Timer.SECOND * 1, addSquare, this);}function update() { if ((game.input.x - 120) > 0 && (game.input.x + 120) <= 480) { arrow.x = ((Math.round((game.input.x - 120) / 120)) * 120) + 55; } function removeSquare(collide, square) { //square.kill(); } game.physics.arcade.overlap(collide, squares, removeSquare, null, this); //if (game.input.activePointer.isDown) { game.input.onDown.add(swap(), this) function swap() { //alert(colorPosition) //alert((arrow.x - 55) / 120 + 1) var swap = colorPosition[(arrow.x - 55) / 120] colorPosition[(arrow.x - 55) / 120] = colorPosition[(arrow.x - 55) / 120 + 1] colorPosition[(arrow.x - 55) / 120 + 1] = swap //alert(colorPosition) this['bucket' + (Math.floor(arrow.x - 55) / 120)].frame = colorPosition[(arrow.x - 55) / 120] //Here's the line the error occurs on this['bucket' + (((arrow.x - 55) / 120) + 1)].frame = colorPosition[((arrow.x - 55) / 120) + 1] this['bucketFront' + (Math.floor(arrow.x - 55) / 120)].frame = colorPosition[(arrow.x - 55) / 120] this['bucketFront' + (((arrow.x - 55) / 120) + 1)].frame = colorPosition[((arrow.x - 55) / 120) + 1] //this['bucketFront' + (arrow.x - 55) / 120].frame = parseInt(colorPosition[(arrow.x - 55) / 120]) //alert(this['bucket' + (((arrow.x - 55) / 120) + 1)].frame) //alert(colorPosition[((arrow.x - 55) / 120) + 1]) }}This is my first attempt to do anything with JavaScript, so please try to be patient.
  12. Hello, I just started to work with making a simple menu. I have a simple script but it doesnt work. The error is: And here is code: var game = new Phaser.Game(500,500, Phaser.AUTO, 'gamediv');game.mainMenu = function(){};game.mainMenu.prototype = { button:null, preload : function() { game.load.spritesheet('new_game_button', 'asset/button/newgame.png'); }, create : function() { this.button = game.add.button(game,50,50, 'new_game_button', function(){ console.log("h"); }, null, 2, 1 ,0); }, update : function() { }, }game.state.add('MainMenu', game.mainMenu);game.state.start('MainMenu');what is wrong with this code? How can i solve this issue? Regards!
  13. Hi all, Another weirdo cross-browser problem I am desperate to fix. A tester running Safari 6.03 (not the most current, but not ancient either), keeps having the game freeze with a strange error: "TypeError: type error" -- it traces back to phaser.min.js line 11 but I'm unable to see what in my code is causing the issue. Is this a known thing? Any advice at all would be appreciated - You guys are the best! Nick
  14. Hi Guys, Excellent work on releasing Phaser 2.0 - I thought it would be time to move over from Construct 2 and try my hand at coding (i'm a newb so please be gentle) I have loaded up the golf demo that comes with 2.0 and have not been able to get it to load correctly. Here is the error that I am seeing in Chrome's JavaScript console:- Uncaught TypeError: Cannot read property 'bounce' of null golf.js:45 creategolf.js:45 Phaser.StateManager.loadCompletephaser.js:13673 Phaser.SignalBinding.executephaser.js:14353 Phaser.Signal.dispatchphaser.js:14226 dispatchphaser.js:13993 Phaser.Loader.nextFilephaser.js:41327 Phaser.Loader.jsonLoadCompletephaser.js:41185 _xhr.onloadphaser.js:40888 Here is how I included the golf.js in my html doc:- <!doctype html><html> <head> <meta charset="UTF-8" /> <title>hello phaser!</title> <script src="phaser.js"></script> <script src="golf.js"></script> </head> <body> <div id="phaser-example"> </div> </body></html>Here is my file structure:- Here is the result in Chrome (its also the same in FireFox):- Maybe I have made a "Newb" mistake but any pointers in the right direction would be gratefully received ! Many thanks in advance.
  15. Hello, I downloaded a copy of phaser and threw it in my MAMP folder - started my local web server. And then created a basic game.html file + game.js + phaser.js. game.html looks like this: <html> <head> <script src="phaser.js"></script> <script src="game.js"></script> </head> <body> <div id="game"></div> </body></html> game.js looks like this: var headImage;var game = new Phaser.Game(800, 600, Phaser.AUTO, 'phaser-example', { preload: preload, create: create, update: update });function preload() { game.load.image('head', 'head.png');}function create() {}function update() {}I opened in chrome, and am seeing a blank page with the following error in the console: "Uncaught TypeError: Cannot read property 'style' of null" I'm not sure what I'm doing wrong.
  16. I got this setup: update: function() { this.balls.forEach(this.ballUpdate, this);}ballUpdate: function(ball) {if (ball.body.y > this.game.world.height + ball.height) {ball.destroy();}}Which results in: Uncaught TypeError: Cannot read property 'alive' of null Game.js:566 BasicGame.Game.ballUpdateGame.js:566 Phaser.Group.forEachphaser.js:12324 BasicGame.Game.updateGame.js:173 Phaser.StateManager.updatephaser.js:10138 Phaser.Game.updatephaser.js:13701 Phaser.RequestAnimationFrame.updateRAFphaser.js:22114 _onLoopphaser.js:22099 I tried: update: function() { if(this.balls.countLiving() > 0) { this.balls.forEach(this.ballUpdate, this); }}
×
×
  • Create New...