Search the Community

Showing results for tags 'bmd'.



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

  1. Hello. I created a wall bmd that is colliding with a movable square bmd. The collision is detected by the getPixel method that checks for pixel color properties. However even when both bmd are far from each other and the square is in the same y coordinates as the square bmd they collide. However when they are distant from each other and the square is not "contained" in the same y coordinates (height) of the wall they do not collide. Any idea? the_wall_bmd = game.add.bitmapData(game_width, game_height); the_wall_bmd.ctx.beginPath(); the_wall_bmd.ctx.rect(0, 200, 100, 200); the_wall_bmd.ctx.fillStyle = '#FFA07A'; the_wall_bmd.ctx.fill(); the_wall_bmd.update(); the_wall = game.add.sprite(0,0,the_wall_bmd, 0,wall_group);
  2. Hello. I have made previous threads about this specific issue but couldn't get my problem solved. This time I made a codepen with my code which might make helping easier: https://codepen.io/PhasedEvolution/pen/mAaNkp?editors=1010 I want to make something similar to this: http://codepen.io/photonstorm/pen/ogZJPP?editors=001 However I am not being able to destroy the bmd I created and I don't know why... Can someone look into this and help me out? Cheers
  3. Greetings. I am trying to do something similar to this: http://codepen.io/photonstorm/pen/ogZJPP?editors=001 However I can't destroy the bmd. I don't know why. // The bmd wall I will generate. I want to "destroy" it when the bombs hit it this.wall_bmd = game.add.bitmapData(game_width, game_height); this.wall_bmd.ctx.beginPath(); this.wall_bmd.ctx.rect(800, 100, 200, 300); this.wall_bmd.ctx.fillStyle = '#FFA07A'; this.wall_bmd.ctx.fill(); this.wall = game.add.sprite(0,0,this.wall_bmd, 0,map_elements_group); game.physics.arcade.enable(this.wall); this.wall.body.immovable = true; this.wall.body.allowGravity = false; this.wall.body.setSize(200, 300, 800, 100); // The way I am generating my bombs (I am also having some doughts here...*1) this.bmd_bomb = game.add.bitmapData(10, 10); this.bmd_bomb.ctx.beginPath(); this.bmd_bomb.ctx.rect(0, 0, 10, 10); this.bmd_bomb.ctx.fillStyle = '#ffffff'; this.bmd_bomb.ctx.fill(); this.bombs_group = game.add.group(); this.bombs_group.enableBody = true; this.bombs_group.physicsBodyType = Phaser.Physics.ARCADE; for(var x = 0; x < 20; x++) { this.bombs_group.bomb = this.bombs_group.create(0,0,this.bmd_bomb); this.bombs_group.bomb.name = 'bomb' + x; this.bombs_group.bomb.exists = false; this.bombs_group.bomb.visible = false; this.bombs_group.bomb.checkWorldBounds = true; this.bombs_group.bomb.events.onOutOfBounds.add(resetbomb,this.bombs_group.bomb); } // My firing bomb function function fireBomb(player_bombs,player_body) { var bomb = player_bombs.getFirstExists(false); if(bomb) { bomb.reset(player_body.x + 30,player_body.y + 20); bomb.body.velocity.x = 300; } } // In the game update function I am doing this (It makes the game REALLY slow) I need a better way to refer to each of the bombs that have been fired... var bombs = this.player.bombs.bombs_group.children; for(var x = 0; x < bombs.length; x++) { if(bombs[x].x != 0) { var bomb = bombs[x]; bombVsMap(bomb,map_elements_group); } } // And probably the biggest problem function bombVsMap (bomb,map_elements) { var wall_bmd = map_elements.wall_bmd; var bomb_x = Math.floor(bomb.x); var bomb_y = Math.floor(bomb.y); var get_collision_pixel = wall_bmd.getPixel(bomb_x,bomb_y); if(get_collision_pixel.a > 255) { wall_bmd.blendDestinationOut(); wall_bmd.circle(bomb_x, bomb_y, 100, 'rgba(0, 0, 0, 255'); wall_bmd.blendReset(); wall_bmd.update(); bomb.kill(); } } . I am not sure if I can use the overlap or the collision phaser functions to handle the bitmap destruction? Or do I have to do it manually like I did to check for "collision" and if so destroy the map and the bullet. . If I do have to check for collision manually how can I refer to each of the spawned bullets without making the game really slow? . Also, I have no idea why the wall is not being destroyed... If I console.log(get_collision_pixel) I see always the "normal pixels". I am with these problems for a few days already... Can someone please give me an hand? Thank you a lot
  4. I have created a simple ground floor as bmd sprite and a player circle bmd sprite. I am having trouble detecting the collision between the floor and the player and when I set the player sprite collideworldbounds property to true the player gets stuck in the upper corner and doesn't fall. Why is that? // global vars var elements_group; var players_group; // Inside create function map_elements_group = game.add.group(); players_group = game.add.group(); game.world.setBounds(0, 0, 500, 200); var player = new Player(300,100); var map = new Map(); // Inside Update function game.physics.arcade.collide(players_group,map_elements_group,playerMapCollision); //console.log("I GET FALSE ",game.physics.arcade.collide(players_group,map_elements_group,playerMapCollision)); var Map = function () { var floor_bmd = game.add.bitmapData(1000, 500); floor_bmd.ctx.beginPath(); floor_bmd.ctx.rect(0, game_height - 100, 1000, 100); floor_bmd.ctx.fillStyle = '#4488AA'; floor_bmd.ctx.fill(); var floor = game.add.sprite(0,0,floor_bmd, 0); game.physics.arcade.enable(floor); floor.body.immovable = true; floor.body.allowGravity = false; } var Player = function (x,y) { this.bmd = game.add.bitmapData(1000, 500); this.bmd.circle(30,30,30,"#E5E4E2"); this.sprite = game.add.sprite(x,y,this.bmd,0,players_group); game.physics.arcade.enable(this.sprite); this.sprite.body.allowGravity = true; this.sprite.body.gravity.y = 800; this.sprite.body.bounce.setTo(0.9, 0.9); //this.sprite.body.collideWorldBounds = true; //When I do this my player gets stuck in the upper corner and doesnt move or fall this.cursors = game.input.keyboard.createCursorKeys(); }
  5. Hi guys, First time poster and novice with Phaser - Just a quick question about the bitmapdata alpha masks in 2.1.1... I've been using 2.0.7 for the last few months and loved the update to Bitmapdata via Pixi 1.6.0, allowing you to use a sourceRect and maskRect to define the size/location of your alpha masks and bmd I've just updated to 2.1.1 this morning and the option for these two arguments for alphaMasks appears to have been removed again according to the definitions file. I've not noticed anything in the changelogs since 2.1.0 to suggest what has happened - is there any work around to define these arguments again, or am I just being stupid and missing the obvious? Many thanks! Cameron
  6. qdrj

    Draw to BitmapData

    Hello everyone, In my game I have big scrolling back(960x640) with parallax which consists of 8 parts. I was thinking to replace it with one bitmapData. I'm going to draw all parts into this bmd and then use it as texture for only one image. It will definetely reduce canvas draw calls but there any shortcomings for this method which i'm missing in theory? I have been done this many times in Flash and it was good for performance.