Permalink
Browse files

Ayron class renamed PlayableCharacter

  • Loading branch information...
is06 committed Feb 9, 2012
1 parent bcfb326 commit f51b2bce215a3b011b0e0080e512934dad0a39dd
@@ -5,15 +5,15 @@ is06.com. Permissions beyond the scope of this license may be available at
http://www.is06.com. Legal code in license.txt
*******************************************************************************/
-#ifndef __IS06_AYRON_H__
-#define __IS06_AYRON_H__
+#ifndef __IS06_PLAYABLE_CHARACTER_H__
+#define __IS06_PLAYABLE_CHARACTER_H__
#include "../../include/3d/Character.h"
-class Ayron : public Character
+class PlayableCharacter : public Character
{
public:
- Ayron(Camera* cam);
+ PlayableCharacter(Camera* cam);
void render();
View
@@ -61,7 +61,7 @@ class PlayerState;
class ModelEntity;
class AnimatedModel;
class Character;
-class Ayron;
+class PlayableCharacter;
class NPC;
class Enemy;
class StaticModel;
@@ -23,7 +23,7 @@ class SceneGameplay : public Scene
virtual void postRender();
protected:
- Ayron* ayron;
+ PlayableCharacter* ayron;
LevelMesh* level;
GameplayInterface* gpInterface;
@@ -32,9 +32,9 @@ class SceneGameplay : public Scene
private:
void manageCameraControl();
- void manageAyronJumps();
- void manageAyronMovements();
- void manageAyronCollisions();
+ void manageCharacterJumps();
+ void manageCharacterMovements();
+ void manageCharacterCollisions();
void manageMenuControl();
};
@@ -6,18 +6,18 @@ is06.com. Permissions beyond the scope of this license may be available at
*******************************************************************************/
#include "../../include/ref/core.h"
-#include "../../include/3d/Ayron.h"
+#include "../../include/3d/PlayableCharacter.h"
#include "../../include/3d/Camera.h"
#include "../../include/3d/Character.h"
using namespace irr;
using namespace std;
/**
- * Ayron entity constructor: defines which mesh to load and set the initial direction
- * @param Camera* cam pointer to a Camera to link to Ayron
+ * PlayableCharacter entity constructor: defines which mesh to load and set the initial direction
+ * @param Camera* cam pointer to a Camera to link to PlayableCharacter
*/
-Ayron::Ayron(Camera* cam) : Character()
+PlayableCharacter::PlayableCharacter(Camera* cam) : Character()
{
controlable = true;
jumpDelta = 0.0f;
@@ -45,15 +45,15 @@ Ayron::Ayron(Camera* cam) : Character()
/**
* Render function, called every cycle
*/
-void Ayron::render()
+void PlayableCharacter::render()
{
Character::render();
}
/**
- * Called while Ayron's floor raycast is NOT in collision with the floor
+ * Called while PlayableCharacter's floor raycast is NOT in collision with the floor
*/
-void Ayron::fall(f32 factor)
+void PlayableCharacter::fall(f32 factor)
{
if (!isJumping) {
if (fallDelta < jumpStrength) {
@@ -68,12 +68,12 @@ void Ayron::fall(f32 factor)
}
/**
- * Called while Ayron's floor raycast is in collision with the floor
+ * Called while PlayableCharacter's floor raycast is in collision with the floor
*/
-void Ayron::raise()
+void PlayableCharacter::raise()
{
if (isFalling) {
- // Ayron is hitting the floor
+ // PlayableCharacter is hitting the floor
fallDelta = 0.0f;
isFalling = false;
}
@@ -85,9 +85,9 @@ void Ayron::raise()
}
/**
- * Called when the player wants Ayron to jump
+ * Called when the player wants PlayableCharacter to jump
*/
-void Ayron::jump()
+void PlayableCharacter::jump()
{
if (isJumping) {
jumpDelta -= gravity;
@@ -106,32 +106,32 @@ void Ayron::jump()
/**
*
*/
-void Ayron::setJumpDelta(f32 value)
+void PlayableCharacter::setJumpDelta(f32 value)
{
jumpDelta = value;
}
/**
*
*/
-f32 Ayron::getJumpDelta()
+f32 PlayableCharacter::getJumpDelta()
{
return jumpDelta;
}
/**
*
*/
-f32 Ayron::getJumpStrength()
+f32 PlayableCharacter::getJumpStrength()
{
return jumpStrength;
}
/**
- * Applies an opposite force to Ayron in order to stop it against a wall
+ * Applies an opposite force to PlayableCharacter in order to stop it against a wall
* Function still under development
*/
-void Ayron::moveOpposite(const core::vector3df& normal)
+void PlayableCharacter::moveOpposite(const core::vector3df& normal)
{
f32 angle = (atan2(normal.X, normal.Z) * -1) + (core::PI / 2);
@@ -143,47 +143,47 @@ void Ayron::moveOpposite(const core::vector3df& normal)
}
/**
- * Move Ayron to the left from camera
+ * Move PlayableCharacter to the left from camera
* @param f32 speed movement speed
*/
-void Ayron::goLeft(f32 speed)
+void PlayableCharacter::goLeft(f32 speed)
{
updateCoords(0, speed);
}
/**
- * Move Ayron to the right from camera
+ * Move PlayableCharacter to the right from camera
* @param f32 speed movement speed
*/
-void Ayron::goRight(f32 speed)
+void PlayableCharacter::goRight(f32 speed)
{
updateCoords(core::PI, speed);
}
/**
- * Move Ayron forward from camera
+ * Move PlayableCharacter forward from camera
* @param f32 speed movement speed
*/
-void Ayron::goForward(f32 speed)
+void PlayableCharacter::goForward(f32 speed)
{
updateCoords((core::PI / 2), speed);
}
/**
- * Move Ayron backward from camera
+ * Move PlayableCharacter backward from camera
* @param f32 speed movement speed
*/
-void Ayron::goBackward(f32 speed)
+void PlayableCharacter::goBackward(f32 speed)
{
updateCoords((3 * core::PI / 2), speed);
}
/**
- * Update Ayron's coordinates when the player wants to move him
+ * Update PlayableCharacter's coordinates when the player wants to move him
* @param f32 deltaU direction value
* @param f32 speed speed value
*/
-void Ayron::updateCoords(f32 deltaU, f32 speed)
+void PlayableCharacter::updateCoords(f32 deltaU, f32 speed)
{
f32 x = cos(core::degToRad(linkedCam->getNode()->getRotation().Y) + deltaU);
f32 z = sin(core::degToRad(linkedCam->getNode()->getRotation().Y) + deltaU);
@@ -194,7 +194,7 @@ void Ayron::updateCoords(f32 deltaU, f32 speed)
));
}
-void Ayron::toggleControl()
+void PlayableCharacter::toggleControl()
{
if (controlable) {
controlable = false;
@@ -206,7 +206,7 @@ void Ayron::toggleControl()
/**
* Returns true if the player has control
*/
-bool Ayron::hasControl()
+bool PlayableCharacter::hasControl()
{
return controlable;
}
View
@@ -8,7 +8,7 @@ is06.com. Permissions beyond the scope of this license may be available at
#include "../../include/ref/core.h"
#include "../../include/Keyboard.h"
#include "../../include/3d/LevelMesh.h"
-#include "../../include/3d/Ayron.h"
+#include "../../include/3d/PlayableCharacter.h"
#include "../../include/gui/BarCounter.h"
#include "../../include/gui/GameplayInterface.h"
@@ -8,7 +8,7 @@ is06.com. Permissions beyond the scope of this license may be available at
#include "../../include/ref/core.h"
#include "../../include/3d/LevelMesh.h"
#include "../../include/3d/TPCamera.h"
-#include "../../include/3d/Ayron.h"
+#include "../../include/3d/PlayableCharacter.h"
#include "../../include/gui/GameplayInterface.h"
#include "../../include/gui/EnergyInterface.h"
#include "../../include/gui/GameplayMenu.h"
@@ -30,7 +30,7 @@ SceneGameplay::SceneGameplay() : Scene()
{
level = new LevelMesh();
cam = new TPCamera();
- ayron = new Ayron(cam);
+ ayron = new PlayableCharacter(cam);
cam->linkEntity(ayron);
gpInterface = new GameplayInterface();
enInterface = new EnergyInterface();
@@ -47,9 +47,9 @@ void SceneGameplay::events()
Scene::events();
manageCameraControl();
- manageAyronJumps();
- manageAyronMovements();
- manageAyronCollisions();
+ manageCharacterJumps();
+ manageCharacterMovements();
+ manageCharacterCollisions();
// Menu
if (keyboard->pressed(KEY_KEY_D, EVENT_ONCE)) {
@@ -103,9 +103,9 @@ void SceneGameplay::manageCameraControl()
}
/**
- * Manages Ayron's jumps. Called every cycle
+ * Manages Character's jumps. Called every cycle
*/
-void SceneGameplay::manageAyronJumps()
+void SceneGameplay::manageCharacterJumps()
{
if (ayron->hasControl()) {
ayron->isJumping = false;
@@ -135,16 +135,16 @@ void SceneGameplay::manageAyronJumps()
}
/**
- * This function manages Ayron's movements, both keyboard and gamepad
+ * This function manages Character's movements, both keyboard and gamepad
* are functionnal. Called every cycle
*/
-void SceneGameplay::manageAyronMovements()
+void SceneGameplay::manageCharacterMovements()
{
if (ayron->hasControl()) {
// Keyboard control
if (keyboard->pressed(KEY_UP) || keyboard->pressed(KEY_DOWN)
|| keyboard->pressed(KEY_LEFT) || keyboard->pressed(KEY_RIGHT)) {
- // Ayron's direction from keyboard's arrows angle
+ // Character's direction from keyboard's arrows angle
ayron->getNode()->setRotation(core::vector3df(
ayron->getNode()->getRotation().X,
cam->getNode()->getRotation().Y - (keyboard->getDirectionAngle() + core::radToDeg(core::PI / 2)),
@@ -167,7 +167,7 @@ void SceneGameplay::manageAyronMovements()
// Joystick control
if (fabs(gamepad->getLeftJoystickXAxis()) > 35
|| fabs(gamepad->getLeftJoystickYAxis()) > 35) {
- // Ayron's direction from joystick's angle
+ // Character's direction from joystick's angle
ayron->getNode()->setRotation(core::vector3df(
ayron->getNode()->getRotation().X,
cam->getNode()->getRotation().Y - (gamepad->getLeftJoystickAngle() + core::radToDeg(core::PI / 2)),
@@ -190,10 +190,10 @@ void SceneGameplay::manageAyronMovements()
}
/**
- * This function manages Ayron collision with floor and wall.
+ * This function manages Character collision with floor and wall.
* Called every cycle
*/
-void SceneGameplay::manageAyronCollisions()
+void SceneGameplay::manageCharacterCollisions()
{
// Check if level was created
if (level->getMesh() == NULL) Game::fatalError(ERRCODE_45);

0 comments on commit f51b2bc

Please sign in to comment.