Jump to content

[NON METIN] Tank game (need help on shooting)


Recommended Posts

Hey guys, i'm working on a university project and well i missed a few classes :D i've got the movement working, tank turrent moving etc but i need to get the shooting and collision if the bullet hits the other tank working then automatic reset to starting positions

 

tank 1 keys

WS <- Movement
AD < - Tank Rotation
Q - E <- Turret rotation

Tank 2 Keys

I - K <- Movement
J - L <- Tank Rotation
U - O <- Turret Rotation

any help is really appreciated

 

The source code is available here: http://pastebin.com/nJzCZgfX

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

  • Bronze

If you want to change some keyboard function, you should be look at game.py

		onPressKeyDict[app.DIK_W]			= lambda : self.MoveUp()
		onPressKeyDict[app.DIK_S]			= lambda : self.MoveDown()
		onPressKeyDict[app.DIK_A]			= lambda : self.MoveLeft()
		onPressKeyDict[app.DIK_D]			= lambda : self.MoveRight()

Kind Regards

HaveBeen

Plain logic saves lives.

Link to comment
Share on other sites

You dont need to write non Metin :D this is general Coding so your topic is right.

Unfortunately i cant solve your problem either :o

 

 

If you want to change some keyboard function, you should be look at game.py

		onPressKeyDict[app.DIK_W]			= lambda : self.MoveUp()
		onPressKeyDict[app.DIK_S]			= lambda : self.MoveDown()
		onPressKeyDict[app.DIK_A]			= lambda : self.MoveLeft()
		onPressKeyDict[app.DIK_D]			= lambda : self.MoveRight()

Kind Regards

HaveBeen

:P I did need to, HaveBeen as stated in the topic title, this isn't regarding Metin2

Link to comment
Share on other sites

  • Bronze

Hey guys, i'm working on a university project and well i missed a few classes :D i've got the movement working, tank turrent moving etc but i need to get the shooting and collision if the bullet hits the other tank working then automatic reset to starting positions

 

tank 1 keys

WS <- Movement
AD < - Tank Rotation
Q - E <- Turret rotation
Tank 2 Keys

I - K <- Movement
J - L <- Tank Rotation
U - O <- Turret Rotation
any help is really appreciated

 

The source code is available here: http://pastebin.com/nJzCZgfX

As fun as it might sound, nobody will go through your entire code and tell you exactly what to do (at least, they shouldn't). Please provide us with a meaningful part of your code, your problem and what isn't working as expected, what have you tried, etc... If you show no research effort whatsoever, why should we?
Link to comment
Share on other sites

in terms of the shooting i don't know how to make it draw a bullet and fire along the angle of the turret, i'm working on the other areas currently such as max speed etc to clean those areas up. i don't know where to start with the bullet itself.

 

the reason why i posted the entire code was so people could test themselves.

// player class

class playerInfo
{

public:

playerInfo();	// the constructor

bool upPressed;	// whether or not they are pressing their "up" key
bool downPressed;	// whether or not they are pressing their "down" key
bool leftPressed;	// and so on
bool rightPressed;
bool turretrightPressed;
bool turretleftPressed;	// and so on
float rotation;	// the rotation of their avatar
float turretrotation;	// the rotation of their avatar
float xPos;	// position in world
float yPos;
float speed;
float A;
float B;

};
playerInfo::playerInfo()

{

upPressed = false;

downPressed = false;

leftPressed = false;

rightPressed = false;

turretleftPressed = false;

turretrightPressed = false;

rotation = 0.0f;

turretrotation = 0.0f;

xPos = 0.0f;

yPos = 0.0f;

speed = 0.0f;

A = 0.0f;

B = 0.0f;

}

// below is from a case statement
currentGame->playerArray[0]->turretleftPressed = true;

if (currentGame->playerArray[i]->turretleftPressed)

{

currentGame->playerArray[i]->turretrotation += (ROTATION_SPEED * deltaAdjustment);

}


now from the above thats jsut the player class and the turret rotation, i need to make it so i can send a bullet along the turrets current rotation angle. umm not sure what other information to provide :/

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

Terms of Use / Privacy Policy / Guidelines / We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.