Spawn different objects withing level
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
#ifndef OBJECT_H
|
||||
#define OBJECT_H
|
||||
|
||||
#include "stdlib.h"
|
||||
#include <iostream>
|
||||
|
||||
class Level;
|
||||
|
||||
class Object {
|
||||
private:
|
||||
Level* level;
|
||||
|
||||
public:
|
||||
int64_t objectUID;
|
||||
bool shouldUpdate = true;
|
||||
|
||||
public:
|
||||
virtual ~Object() { destroyed(); }
|
||||
|
||||
public:
|
||||
virtual void spawned() { }
|
||||
virtual void update(float delta) { }
|
||||
virtual void destroyed() { }
|
||||
|
||||
public:
|
||||
Level* getLevel() { return level; }
|
||||
void setLevel(Level* lvl) { level = lvl; }
|
||||
};
|
||||
|
||||
#endif /* OBJECT_H */
|
||||
@@ -33,7 +33,7 @@ Player::Player(glm::vec3 position, float speed) :
|
||||
Player::~Player() {
|
||||
}
|
||||
|
||||
void Player::update(
|
||||
void Player::updateInput(
|
||||
Level* level,
|
||||
PlayerInput& input,
|
||||
float delta) {
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "../voxels/voxel.h"
|
||||
#include "../settings.h"
|
||||
#include "../interfaces/Serializable.h"
|
||||
#include "../objects/Object.h"
|
||||
|
||||
class Camera;
|
||||
class Hitbox;
|
||||
@@ -32,7 +33,7 @@ struct PlayerInput {
|
||||
bool flight;
|
||||
};
|
||||
|
||||
class Player : Serializable {
|
||||
class Player : Object, Serializable {
|
||||
float speed;
|
||||
int chosenSlot;
|
||||
glm::vec3 spawnpoint {};
|
||||
@@ -52,7 +53,7 @@ public:
|
||||
~Player();
|
||||
|
||||
void teleport(glm::vec3 position);
|
||||
void update(Level* level, PlayerInput& input, float delta);
|
||||
void updateInput(Level* level, PlayerInput& input, float delta);
|
||||
|
||||
void attemptToFindSpawnpoint(Level* level);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user