Pixel Perfect Collision Detection Extension

  ... the case you feel the need for a new feature or want to submit one.

Re: Pixel Perfect Collision Detection Extension

Postby fritz-net » Wed Jul 02, 2014 5:02 pm

Hi guys,

I started to develop an simple test game with andengine and all my testers liked it but they complained about my bad hitbox (don't like it too)

The Problem is that I use TiledSprites and not normal or animated Sprites. Is there a solution to use this extension? converting a TiledSprite to a normal or something like this? Google doesn't really helped me out.

Or is there a other solution to a pixel perfect collision with andengine?

thx


PS.:pls excuse my bad english :?
fritz-net
 
Posts: 1
Joined: Wed Jul 02, 2014 4:52 pm

Re: Pixel Perfect Collision Detection Extension

Postby Hanzo » Tue Dec 16, 2014 1:08 pm

Hi

I'm working with Pixel Perfect Collision makers-f extension and AutoParallaxBackground.

My problem is that the background is loaded the first time and when this autoscroll is as if the image does not refresh in memory. The "player" collides with a original image limit, not the updated (with autoscroll) image

This is a graphic example of the problem

Image

This is a part of the relevant code

Code: Select all
(...)
player = new PixelPerfectSprite((WIDTH / 2) - (texturaPlayer.getWidth() / 2)  , 130, texturaPlayer, getVertexBufferObjectManager()){
         
         @Override
         protected void onManagedUpdate(float pSecondsElapsed) {

            if(leftLimit.collidesWith(this)){               
               score += 1;
               miTexto.setText("ERROR: " + score);
               
            }
            
            if(rightLimit.collidesWith(this)){               
               score += 1;
               miTexto.setText("ERROR: " + score);
               
            }

            super.onManagedUpdate(pSecondsElapsed);
         }
         
      };

autoParallaxBackground = new VerticalAutoParallaxBackground(255, 255, 255, 0);      
      leftLimit = new PixelPerfectSprite((WIDTH / 2) - (this.mParallaxLayerLeft.getWidth() / 3) , this.mParallaxLayerLeft.getHeight() / 2, this.mParallaxLayerLeft, getVertexBufferObjectManager());
      rightLimit = new PixelPerfectSprite((WIDTH / 2) + (this.mParallaxLayerRight.getWidth() / 3), this.mParallaxLayerRight.getHeight() / 2, this.mParallaxLayerRight, getVertexBufferObjectManager());
      autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(-10.0f, leftLimit));
      autoParallaxBackground.attachParallaxEntity(new ParallaxEntity(-10.0f, rightLimit));
      
      sceneEjemplo.setBackground(autoParallaxBackground);

(...)


It's a strange problem. When the "game" starts the player (circle) only collides with the first part of lines (each road limit is a PNG image), when the player crosses the first part of image only collides with the transparent-black line (not exist!). Iis as if the line was projected to the infinite, but not exist.

I've logged player position (getX()) and is the same in left collision during all time

See this example

Image

And this is a video example of the problem :lol:

http://www.youtube.com/watch?v=Co1LBMpEzdo&feature=youtu.be
Hanzo
 
Posts: 12
Joined: Fri Dec 05, 2014 11:47 am

Previous

Return to Features

Who is online

Users browsing this forum: No registered users and 5 guests