UI and other changes
This commit is contained in:
parent
87b5c11fcf
commit
215e24e246
79 changed files with 70023 additions and 2201 deletions
|
|
@ -6,9 +6,9 @@ extends Node3D
|
|||
## scarecrow's from the start; or the corn shooter, Potato Cannon, Shurikens, Propane Torch, or
|
||||
## Alien Ray, every one bought at the supply shed, Upgrades.shop_of "shed"), and pumpkin bombs
|
||||
## in the off-hand (the left, also shed-bought). weapon_next (Tab / d-pad down) cycles through
|
||||
## the main weapons owned; weapon_1..2 (1-2) pick the first two only (Task #7 added more main
|
||||
## weapons than there are number keys — the rest are Tab-cycle only), both only outside build
|
||||
## mode (where those keys pick structures) and with no menu open. The off-hand holds the
|
||||
## the main weapons owned; weapon_1..6 (1-6) pick the first, second, ... of the ones owned
|
||||
## (owned_main: the HUD's hotbar slots, numbered the same way), both only outside build mode
|
||||
## (where those keys pick structures) and with no menu open. The off-hand holds the
|
||||
## off-hand weapon owned (OFFHAND_WEAPONS; there's no pick while there's only one). A main
|
||||
## weapon no longer owned (a retry from before it was bought) goes back to the pitchfork, an
|
||||
## off-hand one out of the hand. The Alien Ray stays hidden (GameConfig "hidden") until enough
|
||||
|
|
@ -85,13 +85,14 @@ const WEAPON_IDS: Array[String] = ["pitchfork", "corn_shooter", "pumpkin_bomb",
|
|||
"propane_torch", "alien_ray"]
|
||||
const WEAPON_NAMES: Array[String] = ["Pitchfork", "Corn shooter", "Pumpkin bombs", "Potato cannon", "Shurikens",
|
||||
"Propane torch", "Alien ray"]
|
||||
## The main weapons (Weapon), in the order weapon_next cycles them, and the off-hand ones.
|
||||
## weapon_1.. only picks the first SWITCH_ACTIONS.size() - 1 of MAIN_WEAPONS directly (no new
|
||||
## number-key actions were added for Task #7's four); the rest are reached by cycling.
|
||||
## The main weapons (Weapon), in the order weapon_next cycles them and the hotbar shows them, and
|
||||
## the off-hand ones. weapon_k picks the k-th main weapon owned (owned_main), one number key per
|
||||
## main weapon.
|
||||
const MAIN_WEAPONS: Array[int] = [Weapon.PITCHFORK, Weapon.CORN_SHOOTER, Weapon.POTATO_CANNON, Weapon.SHURIKENS,
|
||||
Weapon.PROPANE_TORCH, Weapon.ALIEN_RAY]
|
||||
const OFFHAND_WEAPONS: Array[int] = [Weapon.PUMPKIN_BOMB]
|
||||
const SWITCH_ACTIONS: Array[StringName] = [&"weapon_next", &"weapon_1", &"weapon_2"]
|
||||
const SWITCH_ACTIONS: Array[StringName] = [&"weapon_next", &"weapon_1", &"weapon_2", &"weapon_3", &"weapon_4",
|
||||
&"weapon_5", &"weapon_6"]
|
||||
## Main weapons that fire from the muzzle (SIDE_OFFSET/muzzle_distance), so aiming at a target
|
||||
## needs the same muzzle correction as the corn shooter's (attack_toward, the mouse in _update_aim).
|
||||
## The Propane Torch's band runs along the gun's line too (#17), and the Alien Ray's beam (#18).
|
||||
|
|
@ -199,6 +200,16 @@ func owns(w: int) -> bool:
|
|||
return w > 0 and w < WEAPON_IDS.size() and campaign != null and Upgrades.owned(campaign.state, WEAPON_IDS[w])
|
||||
|
||||
|
||||
## The main weapons this scarecrow owns, in MAIN_WEAPONS order: the hotbar's slots, weapon_k
|
||||
## picking the k-th.
|
||||
func owned_main() -> Array[int]:
|
||||
var out: Array[int] = []
|
||||
for w in MAIN_WEAPONS:
|
||||
if owns(w):
|
||||
out.append(w)
|
||||
return out
|
||||
|
||||
|
||||
## Takes the weapon up if it's owned: a main weapon into the hand, an off-hand one into the
|
||||
## off-hand. Returns whether it's there now.
|
||||
func equip(w: int) -> bool:
|
||||
|
|
@ -277,11 +288,10 @@ func tick(dt: float, can_switch: bool) -> void:
|
|||
return
|
||||
if p[&"weapon_next"]:
|
||||
cycle()
|
||||
# Only the first SWITCH_ACTIONS.size() - 1 main weapons have a number key (Task #7 added more
|
||||
# MAIN_WEAPONS than keys; the rest are Tab-cycle only).
|
||||
for k in mini(MAIN_WEAPONS.size(), SWITCH_ACTIONS.size() - 1):
|
||||
var owned := owned_main()
|
||||
for k in mini(owned.size(), SWITCH_ACTIONS.size() - 1):
|
||||
if p[SWITCH_ACTIONS[k + 1]]:
|
||||
equip(MAIN_WEAPONS[k])
|
||||
equip(owned[k])
|
||||
|
||||
|
||||
## One physics tick while the scarecrow can attack: update the aim, then attack with the main
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue