Jump to content

Search the Community

Showing results for tags 'collision bug'.

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

  1. Hello, hope you'll are doing fine. I'm a beginner programmer and recently I've been working on a 2d physics game engine in JavaScript. Everything seemed to be working fine until I have come across an annoying bug in my push mechanic. I have created a 2d collision system where object A will be pushed away b object B, etc. In addition, I have created a push mechanic meaning, object A can push object b (if it’s not solid). However, I have come upon a problem where e.g. object A (Player), object B (box which the player can push) and object C (Solid wall), he problem occurs when object a pushes object b against object, what happens is object B gets pushed away by object A, but object A doesn’t get pushed away by B meaning, object A will get inside of object B and it will push the object to the top instead of pushing it to the left by activating the wrong collision detection. (as seen in the video). Video which shows the problem: https://www.youtube.com/watch?v=8DHKJNOrO54 (Project files below) I've been trying to solve this problem for awhile now and I just can't find the perfect solution. If anyone would be able to help it'd be great. Thank you game_v1.zip
  2. jegor377

    Overlap bug

    Hi! I've got a little problem. My problem is when I try to check overlap object which is moving to some direction (its velocity is 150). Just when it has to collide with the object on its way, it just passes through this object and then the overlapping is not working for any objects... Please, tell me how to fix that (and sorry for my english [and that I don't comment my code. xd]. I'm learning for 2 months.). Player class code which control the bullets: function _Player(){ this.player = game.add.sprite(GameData.levelData.player_data.spawn_point.x*GameData.levelData.tile_size.w, GameData.levelData.player_data.spawn_point.y*GameData.levelData.tile_size.h, 'dude'); game.physics.enable( this.player, Phaser.Physics.ARCADE); this.player.width = GameData.levelData.tile_size.w; this.player.height = GameData.levelData.tile_size.h; this.spark = game.add.sprite(this.player.x-2, this.player.y-(this.player.height+30)/2, 'fire_spark'); ///2+47 this.spark.width = 25; this.spark.height = 32; this.bullets = game.add.group(); this.bullets_count = 0; this.bullets.enableBody = true; this.bullets.physicsBodyType = Phaser.Physics.ARCADE; this.isShoting = false; this.canShoot = false; this.fireTimer = new _MyTimer(1000); this.player.body.drag = {x: 700, y: 700}; this.player.body.collideWorldBounds = true; this.player.anchor.setTo(0.5, 0.5); this.player.animations.add('walk', [1,2,3,4,5,6,7,8], 20, true); game.camera.follow(this.player); this.player.angle = 0; this.spark.anchor.setTo(0.5, 0.5); this.spark.animations.add('fire', [1,2,3,4], 25, true); this.spark.animations.add('do_nothing', [0], 1, true); this.spark.animations.play('do_nothing'); this.destroyBullet = function(bullet, wall) { bullet.kill(); this.bullets_count--; } this.update = function() { GameData.Player.player.angle = game.physics.arcade.angleToPointer(GameData.Player.player)*180/Math.PI+90; //+1.5707963267948966192313216916398 [rad] this.getSparkAngle(); game.physics.arcade.collide(this.player, GameData.tilemap); if(!this.isShoting) this.spark.animations.play('do_nothing'); game.physics.arcade.overlap(this.bullets.getFirstAlive(), GameData.walls, this.destroyBullet, null, this); this.fireTimer.update(); if(this.fireTimer.isTimedUp()) { this.canShoot = !this.canShoot; } } this.getSparkAngle = function() { if(this.spark.frame!=0) { xs = this.player.x; ys = this.player.y; r = (this.player.height+30)/2; n = 360.0; for(i=0; i<(this.player.angle-91.0 > 0.0 ? this.player.angle-91.0 : 360.0+this.player.angle-91.0); i++) { alpha = 6.283185 * i / (n - 1); x = xs + r * Math.cos(alpha); y = ys + r * Math.sin(alpha); } this.spark.x=x; this.spark.y=y; delete xs; delete ys; delete r; delete n; delete alpha; this.spark.angle=this.player.angle; } } this.getBulletAnglePos = function() { xs = this.player.x; ys = this.player.y; r = (this.player.height+60)/2; n = 360.0; for(i=0; i<(this.player.angle-90.0 > 0.0 ? this.player.angle-90.0 : 360.0+this.player.angle-90.0); i++) { alpha = 6.283185 * i / (n - 1); x = xs + r * Math.cos(alpha); y = ys + r * Math.sin(alpha); } return {rx: x, ry: y}; } this.shoot = function() { if(this.canShoot) { this.spark.animations.play('fire'); if(this.bullets_count<15) { this.bullets_count++; bullet_pos = this.getBulletAnglePos(); last_bullet = undefined; last_bullet = this.bullets.create(bullet_pos.xr, bullet_pos.yr, 'bullet'); game.physics.enable( last_bullet, Phaser.Physics.ARCADE); last_bullet.width = 8; last_bullet.height = 11; last_bullet.reset(bullet_pos.rx, bullet_pos.ry); last_bullet.anchor.setTo(0.5, 0.5); last_bullet.angle = this.player.angle; last_bullet.colldeWorldBounds = true; game.physics.arcade.moveToPointer(last_bullet, 150); } this.isShoting=true; } }}This is the only controller
×
×
  • Create New...