The Table Engine
player_input_script.h
Go to the documentation of this file.
1 // player_input_script.h
11 #pragma once
12 
13 #include "script.h"
14 
23 class PlayerInputScript : public Script {
24 public:
30  IDLE = 0,
31  RUN = 1,
32  DEATH = 2
33  };
34 
35 private:
37 
38  float m_playerSpeed = 6;
39  int m_keysCollected = 0;
41 
42 public:
48 
54  int getKeysCollected();
55 
62  void update() override;
63 };
Handles player interactions, movements, and animation states based on game input.
int getKeysCollected()
Retrieves the number of keys collected by the player.
AnimationState m_currentState
Current animation state of the player.
void update() override
Updates player state based on input.
AnimationState
Defines the possible animation states for the player.
@ RUN
Player is moving.
@ DEATH
Player has died.
@ IDLE
Player is standing still.
PlayerInputScript()
Constructor for PlayerInputScript. Initializes the script with default values for player speed and fi...
int m_lastFireTimeInMs
Timestamp of the last fire to regulate shooting frequency.
float m_playerSpeed
Speed at which the player moves.
int m_keysCollected
Number of keys the player has collected.
Base class for scripting custom behaviors in game objects.
Definition: script.h:22
Defines the Script class for attaching behavior to game objects.