Jump to content

Search the Community

Showing results for tags 'objects'.

  • 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
  • Frameworks
    • Phaser 3
    • Phaser 2
    • Pixi.js
    • Babylon.js
    • Panda 2
    • melonJS
  • 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

  1. I'm just curious what are regarded as best practices to avoid the dreaded GC pauses that can mess with the framerate of your game. I've only made some really simple games so I don't really have that much experience with this. Generally the way I've made objects when outside gamedev type situations is pretty close the Crockford-style way of making objects by have a factory function that returns an object literal with functions that closures that refers to variables inside functioning as private variables. (Technically I use TypeScript, but I don't really need to get into the types for this
  2. Hello, I have an issue which keeps me stuck and I could not yet figure it out after being stuck for quite some time. I have a simple game in which obstacles ( spirtes of other cars) drop down from the top of the screen and I am trying to avoid those with my own car not to crash into them. The issue is that on some mobile devices the cars drop WAY faster than on my own device, I tested this from several different phones, the velocity differs depending on the phone, on some the obstacles drop faster on some they drop really slow. What oculd cause such an issue? I can prov
  3. Hi all, I'm working on my first Phaser based game, online documentaion is very useful, but I can't find informations about destroying instances. function Enemy(game, layer, x, y, enemyStyle){ var newX = 0; var newY = 0; switch(enemyStyle){ case 'big_guy': newX = x; newY = y-68; break; case 'fast_guy': newX = x; newY = y-24; break; } var mySprite = game.add.sprite(newX, newY, decoType); mySprite.anchor.setTo(0.5, 0.5); layer.add(mySprite); } Enemy.prototype.delete
  4. When programming my HTML5 2d game I noticed that using the new operator during game play can be quite expensive sometimes if many objects are created. So I wonder what is good practice here? When you implement your game do you always create the objects that are going to be dynamically used from start (for objects such as particles, ammunation, explosions etc), and then reuse them during game play?
  5. I am trying to make a platformer mod of the first tutorial platformer, and this is my first time working with phaser. I am attempting to have diamonds spawn from the sky on a timer, that the player may collect. Everything except the spawning of diamonds seems to be working correctly, my code is as follows: <!--The sprites and some of the movement controls for this game come from this tutorial: https://phaser.io/tutorials/making-your-first-phaser-game --> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Phase
  6. Hi all. I'm trying to return an array of objects loaded by the Mesh Importer for later use. I would like to be able to call a function to load my objects and outside of the function, affect & change each one of them OUTSIDE of the function. Here is the small demo I made :: http://www.babylonjs-playground.com/#1QJUDF#3 Thank you! <3 Mythros
  7. 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; contex
  8. 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 ins
  9. I am creating a Pacman game in JavaScript and have ran into a problem. I am trying to implement the ghost's movement. On each loop, I record the Tile Position of the ghosts var ghostX = Math.round(ghost.x / map.tileWidth); var ghostY = Math.round(ghost.y / map.tileHeight); There are four possible directions in which a ghost can move var moves = [ { 'direction': 'left', 'position': map.getTileLeft(0, ghostX, ghostY).x, 'distance': Math.sqrt(Math.pow((map.getTileLeft(0, ghostX, ghostY).x - pacmanX), 2) +
  10. Hello! I am trying to create a grid of bar elements (to form some kind of net) and I was wondering if there is a way to group these bars, so when I want to move the net, all of the children objects would move also. EXAMPLE: var bar1 = new BABYLON.Mesh.CreateBox(name, 1, scene); var bar2 = new BABYLON.Mesh.CreateBox(name, 1, scene); var bar3 = new BABYLON.Mesh.CreateBox(name, 1, scene); <-- how do I group bar1, bar2, bar3 so that I could use : group.position.x = 10;
  11. So i'm just trying to make a simple collision between falling objects and a players sprite. Its nothing complicated. I'm trying to use the game.physics.arcade.overlap() function. Here is my code: The Player class -> export class Player{ game: Phaser.Game; player: Phaser.Sprite; constructor(game:Phaser.Game){ this.game = game; this.player = this.game.add.sprite(400, 520, "Player"); this.game.physics.arcade.enable(this.player); } create(){ } update(){ if (this.game.input.keyboard.isDown(Phaser.Keyboard.LEFT))
  12. Hi, my project with BabylonJS is growing day to day. Now, I am going to introduce interaction to my scene. I dont know how can I get this. I would like click to some object and see on screen show information of it. To do this I need to know differents way to interact with objects of scene. Also using a gui, I am interested to hide or show differents elements of my world. Could you show me similar examples? Thanks.
  13. Hi there, Just a short intro, big fan of BabylonJS library! It got me excited to work on a new project of mine which is my first game. Bear with me now please, as I am fairly new to it, although I'd say I have done my studies on your API and documentation, which looks very attractive. The issue I am having is that when I scale objects bigger, collision goes wrong; Moving objects collide when they have already overlapped. What I expect is that the collision happens as soon as any face of a bounding box touches any face of the other bounding box The more I scale my objects, the wo
  14. pete796

    Game object

    Hi, Can someone explain the advantage of creating an object (veggies) and then attaching the game object to veggies ? In many examples, the game object is attached isn't attached to another object. Example 1 var Veggies = Veggies || {}; Veggies.game = new Phaser.Game(480, 320, Phaser.AUTO); Example 2 game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, "ph_game");
  15. I have been playing around with Phaser for a couple of days now, but I have been stuck for like the past 3 days on just trying to set up collision with an object layer I set up in Tiled. I am using Arcade Physics here in the main branch. I tried creating the object layer, like you would with any normal tile layer, but the id is always null and errors out. I then did some research and found out that Phaser doesn't support object layers like that. Some objects (treasure chests) I have created in the object layer show up, however. The problem I am having is making the polylines convert to rigid b
  16. I'm pretty mew to phaser and am creating a little zombie shooter. The game is all linear on the X axis. Zombies march towards you and you have to shoot them before they get to you. I am using an array of objects to create the zombies and they all spawn at different locations. The issue I am having is that they seem to be moving at different speeds and catch up with each other. I want to have them move in a consistent speed so they don't overlap but stay in a uniformed movement. I can't figure out for the life of me why that might be. Any help would be greatly appreciated. Thank you in
  17. I built a simple game using phaser, but didn't use multiple game states. The game had only one screen and no states! It was all poorly done. So now I'm learning game states. In this code snippet, taken from a phaser game https://github.com/alexdantas/ludum-dare-29/blob/master/js/states/play.js, we have, for example, a line consisting of this.game.camera.setBoundsToWorld(). I know how this works, but i'm having trouble knowing who is this here. I know this in OOP refers to the "owner" of the function, but in this case, who is it? Another doubt I'm struggling with is, where does t
  18. For visualisation: (http://imgur.com/GFRm4hQ) Hi HTML5 Game Devs Forum. Please bear with my beginner-ish questions! Project aim: A simple 'game' where the user chooses between two options (which highlights their selection inside an ellipse) then locks in their answer. My issue(s) with my current code: It works, but it's pretty bad. Basically everything is duplicated which is obviously poor coding, issue is, I don't know how to use JS objects in concert with Phaser, or how to check it if it were an object, and what I've googled either doesn't look right or goes over my head massively. Nor
  19. So I have 2 classes. A & B. When a specific event occurs in A, a method in B is called. I don't want to create objects in the classes. How else would you do it?
  20. Hi, I've come from an OOP style background with AS3, etc. I'm struggling to work out how to groups things together (kind of like a movieclip in flash). So basically i want to create an object, which will have certain values i can access, but also have created several sprites, and bitmaptext associated with it. Example of how i want to create my object: createNewUpgradeItem:function(myNumber){ var upgradeItem = new UpgradeItem(this, 25, 200+i*55, GAME_NAME.UpgradesAvailable.name, GAME_NAME.UpgradesAvailable.description, GAME_NAME.UpgradesAvailable.upgradePrice, GAME_NAME.UpgradesAvaila
  21. I have a game with a MainMenu state and a Play state. I want to keep my animated background without reloading it (the animation should loop without interruptions) when I change from MainMenu state to Play state. How can I do this?
  22. Hey, I was wondering if it's possible to use either CSS, Canvas, HTML or JavaScript to draw elements for a game (like blocks, characters, etc..) or would I have to use a pre-made image. If this has already been answered, please direct me to the proper thread/website. I'm self-taught so a lot of examples and "dumbing down" is greatly appreciated! Thanks again in advance.
  23. Hi everyone, Here's my 'attempt' in puzzle games - a Construct 2 game called 'Hidden Objects: Pirate Treasure' Try it here: http://www.m.flashfooty.com/games/hidden-objects-pirate-treasure/ This is a free, kids friendly, 'hidden Objects' game in which your seek and find items within the given time. Do not worry - this game doesn't punish mistakes: time is only important to get better result, that is - more 'stars' on each level. The game play is simple: Find a series of hidden objects in a scene! Seek only objects that are shown in the bottom of the screen - with every mistake you'll lose
  24. Hello Im doing the game like arkanoid. The problem is when I try to move the bar with physics. When the bar has collided with the wall it lose the path and don't move straight to left to right. When I also try with moveWithCollisions() it works bad when the bar collide with the ball. How can I resolve this?
  25. When creating States I've seen both people using Objects and Functions. I've noticed that in the Phaser Coding Tips all the examples are using Functions. Is there any advantage in using Functions over Objects in this case? I understand that using Functions + prototype is good for when you are creating classes and then instances of those classes, but in this case there is only 1 of each State in a game.
×
×
  • Create New...