Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bullets.add(new Bullet(x + 15, y + 15, (float) Math.atan2(input.getMouseY() - 1 - (y + 16),input.getMouseX() - 1 - (x + 16)),"normal"));
- +16 is half of the size of the main player
- -1 for some reason
- +15 for some other reason.
- new Bullet(playerx+(plaayerwidth/2)-1,playery+(plaayerheight/2)-1, maths to work out direction, type fo bullet)
- public Bullet(float posx, float posy, float direction, String type){
- this.posx = posx;
- this.posy = posy;
- this.type = type;
- this.direction = direction;
- thecircle = new Circle(posx, posy, 2);
- }
- moving:
- posx += Math.cos(direction) * MainGameState.bulletspeed;
- posy += Math.sin(direction) * MainGameState.bulletspeed;
- thecircle.setLocation(posx, posy);
Add Comment
Please, Sign In to add comment