Add hit reset flag for monsters that charge at players such that they must reset it to damage the player with contact damage again. Player spawn location now reads from the level file. Collision tile data loaded.
This commit is contained in:
+4
-8
@@ -29,11 +29,11 @@ void Player::SetClass(Class cl){
|
||||
}
|
||||
|
||||
void Player::SetX(float x){
|
||||
pos.x=x;
|
||||
pos.x=std::clamp(x,12.f,float(game->WORLD_SIZE.x*24-12));
|
||||
};
|
||||
|
||||
void Player::SetY(float y){
|
||||
pos.y=y;
|
||||
pos.y=std::clamp(y,12.f,float(game->WORLD_SIZE.y*24-12));
|
||||
}
|
||||
|
||||
void Player::SetZ(float z){
|
||||
@@ -221,13 +221,9 @@ void Player::Update(float fElapsedTime){
|
||||
vel.y=std::min(0.f,vel.y+friction*fElapsedTime);
|
||||
}
|
||||
float newX=pos.x+vel.x*fElapsedTime;
|
||||
if(newX-12*size>0&&newX+12*size<game->GetWorldSize().x*24){
|
||||
pos.x=newX;
|
||||
}
|
||||
float newY=pos.y+vel.y*fElapsedTime;
|
||||
if(newY-12*size>0&&newY+12*size<game->GetWorldSize().y*24){
|
||||
pos.y=newY;
|
||||
}
|
||||
SetX(newX);
|
||||
SetY(newY);
|
||||
if(attack_cooldown_timer==0&&game->GetMouse(0).bHeld){
|
||||
switch (cl) {
|
||||
case WARRIOR:{
|
||||
|
||||
Reference in New Issue
Block a user