draw bullet at the end of the barrel

Posted by Alberto on Game Development See other posts from Game Development or by Alberto
Published on 2012-10-07T09:38:31Z Indexed on 2012/10/07 15:50 UTC
Read the original article Hit count: 248

Filed under:
|

excuse my awkwardness, i have this code:

[syntax="java"]

int x2 =  (int) (canon.getSceneCenterCoordinates()[0] + LENGTH_SPRITE/2* Math.cos(canon.getRotation()));
    int y2 = (int) (canon.getSceneCenterCoordinates()[1] + LENGTH_SPRITE/2* Math.sin(canon.getRotation()));


    projectile = new Sprite( (float) x2, (float) y2,
            mProjectileTextureRegion,this.getVertexBufferObjectManager() );

    mMainScene.attachChild(projectile);

[/syntax]

and the bullet are drawn around the cannon in circle.. but not from the end of cannon :( help!

© Game Development or respective owner

Related posts about sprites

Related posts about andengine