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
:
29
enum
AnimationState
{
30
IDLE
= 0,
31
RUN
= 1,
32
DEATH
= 2
33
};
34
35
private
:
36
int
m_lastFireTimeInMs
= 0;
37
38
float
m_playerSpeed
= 6;
39
int
m_keysCollected
= 0;
40
AnimationState
m_currentState
=
IDLE
;
41
42
public
:
47
PlayerInputScript
();
48
54
int
getKeysCollected
();
55
62
void
update
()
override
;
63
};
PlayerInputScript
Handles player interactions, movements, and animation states based on game input.
Definition:
player_input_script.h:23
PlayerInputScript::getKeysCollected
int getKeysCollected()
Retrieves the number of keys collected by the player.
Definition:
player_input_script.cpp:23
PlayerInputScript::m_currentState
AnimationState m_currentState
Current animation state of the player.
Definition:
player_input_script.h:40
PlayerInputScript::update
void update() override
Updates player state based on input.
Definition:
player_input_script.cpp:27
PlayerInputScript::AnimationState
AnimationState
Defines the possible animation states for the player.
Definition:
player_input_script.h:29
PlayerInputScript::RUN
@ RUN
Player is moving.
Definition:
player_input_script.h:31
PlayerInputScript::DEATH
@ DEATH
Player has died.
Definition:
player_input_script.h:32
PlayerInputScript::IDLE
@ IDLE
Player is standing still.
Definition:
player_input_script.h:30
PlayerInputScript::PlayerInputScript
PlayerInputScript()
Constructor for PlayerInputScript. Initializes the script with default values for player speed and fi...
Definition:
player_input_script.cpp:19
PlayerInputScript::m_lastFireTimeInMs
int m_lastFireTimeInMs
Timestamp of the last fire to regulate shooting frequency.
Definition:
player_input_script.h:36
PlayerInputScript::m_playerSpeed
float m_playerSpeed
Speed at which the player moves.
Definition:
player_input_script.h:38
PlayerInputScript::m_keysCollected
int m_keysCollected
Number of keys the player has collected.
Definition:
player_input_script.h:39
Script
Base class for scripting custom behaviors in game objects.
Definition:
script.h:22
script.h
Defines the Script class for attaching behavior to game objects.
Engine
include
player_input_script.h
Generated by
1.9.1