Search the Community

Showing results for tags 'javascript'.



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
    • 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 673 results

  1. Part 6 of my tutorial series on making Slither.io is here! https://loonride.com/learn/phaser/slither-io-part-6 Check out the demo: https://loonride.com/examples/slither-io/part-6/ Enjoy!
  2. Hi! I can access the x parameter on this.draw() function, why it doesn't work on this.updateRotation()?? After I create a Shooting Module on my game loop I can access the getX(). What I am missing? function ShootingModule(_canvas){ this.x = 200; this.y = 500; this.radius = 16; this.rotation = 0; this.canvas = _canvas; this.color = "blue"; this.draw = function (context){ context.beginPath(); context.translate(this.x, this.y); context.rotate(this.rotation * Math.PI / 180); context.arc(0, 0, this.radius, 0, Math.PI * 2, true); context.fillStyle = this.color; context.fill(); context.fillRect(-6, -this.radius -6, 12, 12); context.stroke(); context.setTransform(1, 0, 0, 1, 0, 0); }; this.updateRotation = function(e){ console.log(this.x); this.rotation = Math.atan2(e.clientY - this.y, e.clientX - this.x); }; this.update = function(){ }; this.getX = function(){ return this.x; }; } In my main loop script: playerShootingModule = new ShootingModule(canvas); canvas.addEventListener('mousemove', playerShootingModule.updateRotation, true);
  3. stnight99

    PhaserJS - Creating Grid Layout

    Hello Team, I wanna ask if there are some way to create a grid, for example, i would like to create a 4x4 grid, and each grid i will insert an image, is this possible on PhaserJS? Thanks
  4. away168

    [Legacy] Infinite Gears

    Hi guys, I want to share my game project that I have created in 2013. It was developed for 2 months but unable to finish it due to some unavoidable circumstances. Introducing Infinite Gears! Infinite Gears is an open-world, survival, 2D space-shooting, bullet-hell game (Whew!). As a Player, you can select a spaceship and start wandering through planets and destroy enemy motherships who are taking over those planets, while also fighting against some small enemies along the way. Each spaceship has its own power. One that focuses on pure power, one that focuses on single-target, and one that can protect itself from enemy attacks. As the Player saved a planet, Player can start buying upgrades so the ship gets stronger. The upgrade cost scraps you got from defeating an enemy. The scraps are then converted into GEARS to buy upgrades from the shop. There is an Overdrive (O.D.) bar that is generated by killing enemies. If this is triggered, it will grant you maximum power of that spaceship for a limited time. The enemies also get stronger as you go further away from where you start. This is indicated by the map on bottom right. There are sectors that are determined as levels to indicate that there will be more enemies and stronger enemy motherships. You must eliminate them as much as you can, and see how far you can go! The game should work on desktop browser at least IE9, Chrome, Firefox, and Opera. How to Play Clone or download this project, extract, and go to the project folder. Inside the ./bin folder, run the index.html. Use ASWD to move the spaceship. Use LMB (Left Mouse Button) to shoot. Use Space bar to throw off the bomb. Attack target is based on the mouse cursor. Last Note The game project was developed by Annobox (me and the illustrator) around June - July 2013 (2 months) for a competition and was still in development, but is no longer continued since then. The development is discontinued until now, so there won't be any fix. JavaScript has changed so long since this project and I have my latest code been changed a lot since then, especially after ES6 gets global. So I hope you enjoy the game and the source code! Play it Here: https://www.crazygames.com/game/infinite-gears
  5. This is a project that I have been working on for a year or so. It is a game development studio equipped with a pixel paint editor, map editor, code editor, game engine, store, and message board. It is even possible to edit the source code of the app via a built in editor. My motivation for creating this is to create a tool that I can use to create my games and share with others. Something like Mario Maker. This project is written 100% in JavaScript and uses Electron as a platform to run. Francois DIY was once a web site but due to network lag and downtime I made it native. Anyways, would like to share and maybe have level built for me! Access online: http://www.francoisdiy.com Video of Project in Action:
  6. Part 5 of our series has arrived: https://loonride.com/learn/phaser/slither-io-part-5 Also check out the demo for this part: https://loonride.com/examples/slither-io/part-5/ In this part you will learn how to add those awesome eyes to your snakes!
  7. Mythros

    Cannon JS Problems

    Hi all. I'm not really new here, but technically I am since I haven't logged on in about 4 years. I need some help fixing this cannon JS playground I created. 1st thing's 1st. Why are all the spheres rendering slowly once they touch the ground of the terrain height map? I want this to run at a persistent 60 Frames Per Second. Second thing. I want to have the camera as a "player" in which he can walk all around the heightmap terrain and up NON-STEEP slopes where he slowly slides down STEEP slopes. Forgive me if I'm being a little too less descriptive. I will try my best to explain if that is the case. Anyways, thank you ALL VERY much for all the help! <3 Here is the link to the playground : https://playground.babylonjs.com/#7JDXMW#22 Mythros
  8. I am looking to hire a HTML5 game developer to build Snooker and Billiards games. This is a paid assignment, we can work on a fixed fee or on hourly basis. Please mail your interest and portfolio to ram@digient.in
  9. I have a two player mini game, with all the main logic happening in this: function SpriteDoObj(player){ // global function this.player = player; this.atk = function(opponent) { this.opponent = opponent; if (this.player.overlap(opponent)) { //call miss sound here console.log("miss"); return; } else if (this.isSameAtkPosition(opponent)) { //call block sound console.log("block"); return; } else { console.log("hit!"); //call damage sound opponent.health --; } }; } //has been simplified And I make two instances of SpriteDoObj with: this.blueSpriteDo = new SpriteDoObj(blue_player); this.redSpriteDo = new SpriteDoObj(red_player); //.. also the players are made like this: this.players = this.game.add.physicsGroup(); var red_player = this.players.create(window.innerWidth, this.world.height - 490, 'red_spritesheet'); var blue_player = this.players.create(0, this.world.height - 490, 'blue_spritesheet'); And the atk function is called like this: if (blue_keyMap.atk.isDown) { this.blueSpriteDo.atk(this.redSpriteDo); //the parameter for the atk function //passes the opposite player, that becomes the opponent } The error is phaser.js:47751 Uncaught TypeError: displayObject.getBounds is not a function And I'm not sure why this is happening, mayhaps something to do with how I'm passing the objects around, but it looks good to me - though I'm a noob. Any Ideas?
  10. Hello everyone ! I made a memory game called Click&Match using Phaser.io . It is a cordova based html5 app developed using Intel XDK. This is my very first game. You can download it on Play Store here https://play.google.com/store/apps/details?id=com.MightyRobot.ClickAndMatch Please be sure to rate and review if you do download.
  11. Is there a way to call specific function or event when render finishing with rendering specific sprite or event when shader is executed ?
  12. I'm building line chart using the pixi.js lineTo method. The problem is the lines are shrinking when a distance between points becomes smaller. For testing purpose, I'm trying to draw 200,000 points on that chart. Drawing function: var dataSet = ohlcStore[chartProperty.sym]; if (dataSet && dataSet.length > 0) { var plot = new PIXI.Graphics(); plot.setTransform(columnSize, (renderer.view.height - rowSize) + (Val_min * yScale), 1, -1 * yScale); plot.lineStyle(0.6, chartProperty.lineColor, 1); plot.moveTo(0, dataSet[0].close); for (i = 1; i < dataSet.length; i++) { try { plot.lineTo(i * xScale, dataSet[i].close); } catch (x) { console.error("Error - " + x); } } plot.endFill(); context.addChild(plot); } Result drawing is attached along with this. In this case, xScale is 0.006475032375161876 and Using the canvas render gives correct results. Trying to search for the problem, I've found that the Pixi.js may have an issue with non-integer values. Therefore I've rounded values to integer but the problem didn't solve. Please support to fix this problem.
  13. Muthar

    overlap

    hey guys hey i am new this , i am making a game and in this game i wanted when the player overlap with the coin, the coin disappear but its not over for some reason and i don't why. i have tired a lot of ways even i tired asking the coin into a tile when i made the map but even than it still doesn't work this is my code var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render }); function preload() { game.load.tilemap('level12', 'res/level12.json', null, Phaser.Tilemap.TILED_JSON); game.load.image('sprite12', 'res/sprite12.png'); game.load.spritesheet('dude', 'res/player.png', 64, 64); game.load.spritesheet('droid', 'res/droid.png', 32, 32); game.load.image('starSmall', 'res/star.png'); game.load.spritesheet('coin', 'res/coin.png',32,32 ); game.load.image('background', 'res/sprite3.png'); } var map; var tileset; var layer; var player; var facing = 'left'; var jumpTimer = 0; var cursors; var jumpButton; var bg; var coin; function create() { game.physics.startSystem(Phaser.Physics.ARCADE); game.stage.backgroundColor = '#000000'; bg = game.add.tileSprite(0, 0, 800, 600, 'background'); bg.fixedToCamera = true; map = game.add.tilemap('level12'); map.addTilesetImage('sprite12'); map.addTilesetImage('coin'); map.setCollisionBetween(1, 12); map.setCollisionByExclusion([ 13, 14, 15, 16, 46, 47, 48, 49, 50, 51 ]); layer = map.createLayer('Tile Layer 1'); layer.resizeWorld(); coin = game.add.group(); coin.enableBody = true; coin.physicsBodyType = Phaser.Physics.ARCADE; createcoin(); game.physics.arcade.gravity.y = 200; player = game.add.sprite(150, 900, 'dude'); game.physics.enable(player, Phaser.Physics.ARCADE); player.body.bounce.y = 0.2; player.body.collideWorldBounds = true; player.animations.add('left', [3,2,1,0], 10, true); player.animations.add('right', [4,5,6,7], 10, true); game.camera.follow(player); cursors = game.input.keyboard.createCursorKeys(); jumpButton = game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); game.physics.arcade.overlap(coin, player, killcoin(), null, this); } function killcoin(coin,player) { coin.kill(); } function createcoin() { coin = game.add.sprite(50,700, 'coin'); } function update() { game.physics.arcade.collide(player, layer); player.body.velocity.x = 0; if (cursors.left.isDown) { player.body.velocity.x = -150; if (facing != 'left') { player.animations.play('left'); facing = 'left'; } } else if (cursors.right.isDown) { player.body.velocity.x = 150; if (facing != 'right') { player.animations.play('right'); facing = 'right'; } } else { if (facing != 'idle') { player.animations.stop(); if (facing == 'left') { player.frame = 0; } else { player.frame = 5; } facing = 'idle'; } } if (jumpButton.isDown && player.body.onFloor() && game.time.now > jumpTimer) { player.body.velocity.y = -250; jumpTimer = game.time.now + 750; } } function render () { } if anyone can help would be great Regards
  14. Hi All, I am a JavaScript developer with more than 7+ years of experience on HTML5 game development, i can work on game development for multiple platforms. I can work on projects with limited timeline and budget, available for both part time and full time. Regards, Gideon
  15. What physics engines are available for Javascript and/or Typescript? I've searched myself but maybe there's one or two I missed. I also found a post in these forums but that's over two years old now; It's a little disappointing to see that some of them aren't actively developed and lacking a lot of features. I put together a test to compare the different engines I tried - I've attached the files if anyone wants to try it out. Here are the engines I've tried: PhysicsJs http://wellcaffeinated.net/PhysicsJS/ - Incomplete: lacking simple features like constraints - Seems like it was last updated 2 years ago - Possibly the worst performance - Strange API (in my opinion) and difficult to use - Built in mouse interaction behaves strangely MatterJs http://brm.io/matter-js/ - Also incomplete and lacking constraints - Has a built in mouse constraint but it acts strangely - Updated recently - Simple and easy to use - Doesn't handle stress test well p2.js http://schteppe.github.io/p2.js/ - Complete - Updated within the last few months - Doesn't handle stress test well - Easy to use - Good documentation Box2DWeb https://github.com/hecht-software/box2dweb - Complete - everything you would expect from Box2D - Last updated one or two years ago - Semi-poor documentation - you have use the box2d flash documentation which is fairly thorough but slightly outdated - Much faster and a lot more accurate than the above three libraries. Nape http://napephys.com/ - Complete - lots of features - but isn't very active - Has a great marching squares utility which can convert bitmaps into polygons - Good site and documentation - Easy to use but the pooling get/dispose stuff can be a bit confusing - Similar (or maybe even slight better) performance to Box2DWeb and possibly more accurate - Large - minified it's still 1.7MB The one problem with Nape though is that it isn't really meant for Javascript and I had a lot of trouble getting it set up in Typescript. There were some project to convert it to js and generate definition files but I had to modify them a lot to get something complete that worked for me. I also had to manually convert the debug draw classes from as3 to js and Easeljs. Luckily that only needs to be done once - after that I didn't have any problems using it though. I also tried PhysicsType2D (http://physicstype2d.com/) but couldn't get it to work. Overall I was a bit disappointed; In terms of performance, the 'native' js libraries fell short by a lot compared to the two ported ones, and on top of that they lacked a lot of important features. Even the ported ones didn't perform as well as their Flash/As3 versions - the Nape stress test (you can find it here) which I copied, runs significantly better in flash. PhysicsLib.zip UPDATE: You can find the updated github repo here: https://github.com/cmann1/Javascript-Physics-Library-Tests/
  16. I have a player in a group like this: this.players = this.game.add.physicsGroup(); blue_player = this.players.create(0, this.world.height - 490, 'blue_player'); this.players.setAll('body.bounce.y', 0.2); this.players.setAll('body.gravity.y', 1000); this.players.setAll('collideWorldBounds', true); blue_player.animations.add('idle',[0,1,2],2.1,true); this.players.callAll('animations.play', 'animations', 'idle'); And I add a function to my game prototype that is called by my update function: blue_controls: function () { if (blue_keyMap.jump.isDown) { console.log("blue is going up in the world"); this.players.blue_player.body.velocity.y = 2000; } }, And get: TypeError: Cannot read property 'body' of undefined The error is with this line: this.players.blue_player.body.velocity.y = 2000; I have tried just this.blue_player.body.velocity but get blue_player undefined, and others. I've ran out of things to try that I can think of. I know I'm not referencing the object correctly, but I'm currently putting in the milage to learn object Inheritance and prototypes - and using this game I'm making as practice. I'm just a little stuck, help a noob out?
  17. I want to make a group called players and then assign things to it like this.players.body.gravity.y = 1000;, etc then make a red and blue player from that group that are identical but for the spreadsheets used, so i don't have to set gravity and other things of the sort twice for each. Are groups the best way to do this? I've tried with this code, but get "TypeError: Cannot read property 'bounce' of undefined" as an error myGame.Game.prototype.create = function () { console.log("create is working"); this.platforms = this.add.physicsGroup(); this.platforms.enableBody = true; this.platforms.setAll('body.immovable', true); var ground = this.platforms.create(0, this.world.height - 64, 'ground'); ground.scale.setTo(2, 2); ground.visible = false; var background = this.add.sprite(0, 0, 'background'); background.animations.add("background", [0,1,2,3,4,5,6,7,8], 10, true); background.animations.play("background"); background.width = this.game.width; background.height = this.game.height; this.world.sendToBack(background); //used this to place background behind platforms this.players = this.game.add.group(); //make player group this.players.body.bounce.y = 0.2; //give play group things so that red_player and blue_player this.players.body.gravity.y = 1000;//will have them this.players.body.collideWorldBounds = true; this.players.blue_player.animations.add('idle', [0, 1, 2], 2, true); this.players.animations.play('idle'); var red_player = this.players.create(10000, this.world.height - 490, 'red_player'); var blue_player = this.players.create(0, this.world.height - 490, 'blue_player'); this.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR).onDown.add(this.blue_jump, this); }; My knowledge of objects is terrible, but I can see any problems with what I've done, can anyone help me out? Thanks for reading.
  18. I have application made using Pixi.js and it uses a WebGLRenderer. I'm preserving the drawing buffer and not clearing before render: { preserveDrawingBuffer: true, clearBeforeRender: false } This allows me to create trails as objects move around. I want the trails to fade out over time, so I apply a transparent black rectangle on top over every rendering. This works, but the fade out eventually rounds off to gray. I want a complete fade to black. I've tried using a ColorMatrixFilter filter with a lowered brightness on my root container, hoping it would cause a fade effect. It didn't cause any fade effect, instead just causing everything to be slightly darker. If that had worked, then a custom filter could help to do the job. How can I get a slow gradual fade to complete black for the trails of my rendered objects? I've also asked this on StackOverflow: https://stackoverflow.com/questions/44866613/trailing-fade-to-complete-black-with-pixi-js-and-webglrenderer
  19. Noob here, I'm trying to get an update function to call inside a separate JS file. I have a basic phaser structure in load.js: var myGame = {}; myGame.load = function (game) { }; myGame.load.prototype = { preload: function() { //.. }, create: function(){ //... } }; myGame.update = function(game) { }; myGame.load.prototype = { update: update }; And the update function I'm trying to add and call in update.js update = function() { game.physics.arcade.collide(blue_player, platforms); console.log("update is working"); }; load.js is loaded before update.js in my HTML Thanks a lot for reading
  20. Phaser CE v2.8.0 | WebGL I have a game with lots of enemies, and each enemy needs to shoot out blood particles when attacked. My problem is, my world size is much larger than the size of the emitter bitmapdata that ParticleStorm creates. I tried making it larger, but that caused extreme lag. Then I tried making an emitter for each enemy, and moving the x/y coordinates of the emitter's display to the enemy's location: this also caused heavy lag after just 2 or 3 emitters were created. Any ideas on what I can do to have enemies emit particles across a large map (1920x1920)?
  21. Draxy

    Making states work

    Noob here, Having a hard time with making game states to work - I've been following tutorials and still no luck. I'm really looking for an overview of what I have so far on states, more so than an error fix (witch is loadState is not defined in index.html line 23) HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>game v1</title> <script src="phaser.js"></script> <script src="jquery-3.2.1.js"></script> <script src="loadState.js"></script> <script src="update.js"></script> <link rel="stylesheet" href="css/game.css"> </head> <body> <div class="gameDiv"></div> </body> <script type="text/javascript"> (function() { var width = window.innerWidth; var height = window.innerHeight; var game = new Phaser.Game(width, height, Phaser.AUTO, 'gameDiv'); game.state.add("loadState",loadState); game.state.add("updateState",updateState); game.state.start("loadState"); })(); </script> </html> loadState.js: var loadState = { preload: function() { game.load.spritesheet("background" , "assets/backgroundgif2.png", 800, 336); game.load.image("ground","assets/red.png"); game.load.spritesheet("blue_player", "assets/player_sprites/playertwo standing.png", 96, 96); }, create: function(){ game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT; game.physics.startSystem(Phaser.Physics.ARCADE); platforms = game.add.group(); platforms = game.add.physicsGroup(); var background = game.add.sprite(0, 0, 'background'); background.animations.add("background", [0,1,2,3,4,5,6,7,8], 10, true); background.animations.play("background"); background.width = game.width; background.height = game.height; game.world.sendToBack(background); //used this to place background behind platforms var ground = platforms.create(0, game.world.height - 64, 'ground'); platforms.enableBody = true; platforms.setAll('body.immovable', true); ground.scale.setTo(2, 2); ground.alpha = 0; //used this to make the ground transparent blue_player = game.add.sprite(-10, game.world.height -490, 'blue_player'); game.physics.arcade.enable(blue_player); blue_player.body.bounce.y = 0.2; blue_player.body.gravity.y = 300; blue_player.body.collideWorldBounds = true; blue_player.animations.add('idle', [0, 1, 2], 2, true); blue_player.animations.play("idle"); game.state.start("updateState"); } }; and updateState.js: I have also had var updateState error as undefined, witch does not happen in the tutorials I've used. Though this does not happen now with the code you see here. console.log("update is working"); var updateState = { update: function() { game.physics.arcade.collide(blue_player, platforms); } }; Thanks for reading, hope you can set me straight.
  22. GodsVictory

    Multiplayer desync

    What am I doing wrong here. Normal movement is fine, but when boost is applied, there is rubber banding at the end. I'm using client/server model to implement movement. pseudo code: Client sends inputs to server Client process inputs and displays locally Server receives inputs and calculates where client should be Server emit client coordinates Client receives update and applies coordinates Client reapply all inputs made after the last server update Player class: https://github.com/GodsVictory/SuperOnRoad/blob/wip/public/js/player.js Server code: https://github.com/GodsVictory/SuperOnRoad/blob/wip/server.js
  23. Bossman759

    How to create multiple levels?

    How would I create multiple levels. For example, after I hit a checkpoint, the game will load a new level? This is the code I currently have, it just loads a few blocks(level 1). boxes = game.add.group(); boxes.enableBody = true; var blocks = boxes.create(300, game.world.height - 125, 'block2'); blocks.body.immovable = true; blocks = boxes.create(400, game.world.height - 125, 'block2'); blocks.body.immovable = true; blocks = boxes.create(400, game.world.height - 150, 'block2'); blocks.body.immovable = true; blocks = boxes.create(625, game.world.height - 125, 'block2'); blocks.body.immovable = true; blocks = boxes.create(650, game.world.height - 150, 'block2'); blocks.body.immovable = true; blocks = boxes.create(650, game.world.height - 125, 'block2'); blocks.body.immovable = true;
  24. Thunderfist

    HTML5 JS Quiz help

    I'm trying to make a quiz that sends you to a different page based on your answers, and I was wondering if it's possible to use conditionals to decide which page you'll be sent to. Is it?
  25. I just wanted to bring this article to your eyes: https://blog.sucuri.net/2015/03/why-a-free-obfuscator-is-not-always-free.html Resume of the linked article: some online obfuscators may add spamming code to your obfuscated javascript. Also, I am currently giving Google Closure Compiler ( https://developers.google.com/closure/compiler/ ) a try in advanced mode, if anybody wants to add some cool tips, thanks.