Fix for weapon position

This commit is contained in:
Attila Uygun 2022-11-10 21:03:15 +01:00
parent 10e272fee1
commit cb81ec3e1c
2 changed files with 3 additions and 4 deletions

2
.vscode/launch.json vendored
View File

@ -8,7 +8,7 @@
"name": "(gdb) Launch", "name": "(gdb) Launch",
"type": "cppdbg", "type": "cppdbg",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/build/linux/gltest_x86_64_debug", "program": "${workspaceFolder}/build/linux/demo_x86_64_debug",
"args": [], "args": [],
"stopAtEntry": false, "stopAtEntry": false,
"cwd": "${workspaceFolder}/build/linux", "cwd": "${workspaceFolder}/build/linux",

View File

@ -171,7 +171,7 @@ void Player::Reset() {
Vector2f Player::GetWeaponPos(DamageType type) const { Vector2f Player::GetWeaponPos(DamageType type) const {
return Engine::Get().GetScreenSize() / return Engine::Get().GetScreenSize() /
Vector2f(type == kDamageType_Green ? 3.5f : -3.5f, -2) + Vector2f(type == kDamageType_Green ? 3.5f : -3.5f, -2) +
Vector2f(0, weapon_[type].GetSize().y * 0.7f); Vector2f(0, weapon_[type].GetSize().y * 0.95f);
} }
Vector2f Player::GetWeaponScale() const { Vector2f Player::GetWeaponScale() const {
@ -256,13 +256,12 @@ void Player::SetupWeapons() {
drag_sign_[i].SetZOrder(21); drag_sign_[i].SetZOrder(21);
drag_sign_[i].SetFrame(i * 8); drag_sign_[i].SetFrame(i * 8);
Vector2f pos = GetWeaponPos((DamageType)i);
// Setup weapon. // Setup weapon.
weapon_[i].Create("weapon_tex", {8, 2}); weapon_[i].Create("weapon_tex", {8, 2});
weapon_[i].SetZOrder(24); weapon_[i].SetZOrder(24);
weapon_[i].SetVisible(true); weapon_[i].SetVisible(true);
weapon_[i].SetFrame(wepon_warmup_frame[i]); weapon_[i].SetFrame(wepon_warmup_frame[i]);
Vector2f pos = GetWeaponPos((DamageType)i);
weapon_[i].SetPosition(pos); weapon_[i].SetPosition(pos);
// Setup beam. // Setup beam.