oops
This commit is contained in:
@ -4,15 +4,21 @@
|
||||
void
|
||||
entity_player_init(ECS* ecs, u32 id, vec3 position)
|
||||
{
|
||||
ComponentGameObject* gameObject;
|
||||
ComponentAmmo* ammo;
|
||||
ComponentControlMove* controlMove;
|
||||
ComponentControlShoot* controlShoot;
|
||||
ComponentGameObject* gameObject;
|
||||
ComponentHealth* health;
|
||||
ComponentShoot* shoot;
|
||||
|
||||
gameObject = ecs_component_add(ecs, ECS_COMPONENT_GAME_OBJECT, id);
|
||||
ammo = ecs_component_add(ecs, ECS_COMPONENT_AMMO, id);
|
||||
controlMove = ecs_component_add(ecs, ECS_COMPONENT_CONTROL_MOVE, id);
|
||||
controlShoot = ecs_component_add(ecs, ECS_COMPONENT_CONTROL_SHOOT, id);
|
||||
gameObject = ecs_component_add(ecs, ECS_COMPONENT_GAME_OBJECT, id);
|
||||
health = ecs_component_add(ecs, ECS_COMPONENT_HEALTH, id);
|
||||
shoot = ecs_component_add(ecs, ECS_COMPONENT_SHOOT, id);
|
||||
|
||||
ecs_component_add(ecs, ECS_COMPONENT_CONTROL_SHOOT, id);
|
||||
ecs_component_add(ecs, ECS_COMPONENT_CONTROL_AIM, id);
|
||||
|
||||
component_game_object_init
|
||||
(
|
||||
@ -33,8 +39,13 @@ entity_player_init(ECS* ecs, u32 id, vec3 position)
|
||||
component_shoot_init
|
||||
(
|
||||
shoot,
|
||||
(EntityGameObjectInit)entity_snake_init,
|
||||
(ProjectileInit)entity_snake_init,
|
||||
PLAYER_SHOOT_SPEED,
|
||||
PLAYER_SHOOT_OFFSET
|
||||
);
|
||||
|
||||
component_control_shoot_init(controlShoot, PLAYER_CONTROL_SHOOT_DELAY);
|
||||
|
||||
component_health_init(health, PLAYER_HEALTH_MAX);
|
||||
component_ammo_init(ammo, PLAYER_AMMO_MAX);
|
||||
}
|
||||
|
@ -1,11 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "../../ecs_component.h"
|
||||
#include "../../component/action/component_shoot.h"
|
||||
#include "../../component/component_game_object.h"
|
||||
#include "../../component/component_control_move.h"
|
||||
#include "../../component/component_control_shoot.h"
|
||||
#include "../../component/component_shoot.h"
|
||||
#include "../../component/component_lifetime.h"
|
||||
#include "../../component/control/component_control_aim.h"
|
||||
#include "../../component/control/component_control_move.h"
|
||||
#include "../../component/control/component_control_shoot.h"
|
||||
#include "../../component/stat/component_ammo.h"
|
||||
#include "../../component/stat/component_health.h"
|
||||
#include "../../component/stat/component_lifetime.h"
|
||||
#include "../../ecs_component.h"
|
||||
|
||||
#include "entity_snake.h"
|
||||
|
||||
@ -14,6 +17,9 @@
|
||||
#define PLAYER_VELOCITY_MAX 6
|
||||
#define PLAYER_SHOOT_SPEED 5
|
||||
#define PLAYER_SHOOT_OFFSET 32
|
||||
#define PLAYER_CONTROL_SHOOT_DELAY 15
|
||||
#define PLAYER_AMMO_MAX 1
|
||||
#define PLAYER_HEALTH_MAX 3
|
||||
static const vec2 PLAYER_SIZE = {50.0f, 100.0f};
|
||||
|
||||
void entity_player_init(ECS* ecs, u32 id, vec3 position);
|
||||
|
@ -2,11 +2,13 @@
|
||||
|
||||
/* Initializes a snake entity. */
|
||||
void
|
||||
entity_snake_init(ECS* ecs, u32 id, vec3 position)
|
||||
entity_snake_init(ECS* ecs, u32 id, vec3 position, u32 sender)
|
||||
{
|
||||
ComponentGameObject* gameObject;
|
||||
ComponentReturn* returnComponent;
|
||||
|
||||
gameObject = ecs_component_add(ecs, ECS_COMPONENT_GAME_OBJECT, id);
|
||||
returnComponent = ecs_component_add(ecs, ECS_COMPONENT_RETURN, id);
|
||||
|
||||
component_game_object_init
|
||||
(
|
||||
@ -21,4 +23,13 @@ entity_snake_init(ECS* ecs, u32 id, vec3 position)
|
||||
SNAKE_FRICTION,
|
||||
SNAKE_VELOCITY_MAX
|
||||
);
|
||||
|
||||
component_return_init
|
||||
(
|
||||
returnComponent,
|
||||
SNAKE_RETURN_SPEED,
|
||||
SNAKE_RETURN_VELOCITY_MAX,
|
||||
SNAKE_RETURN_LIFETIME,
|
||||
sender
|
||||
);
|
||||
}
|
||||
|
@ -2,10 +2,14 @@
|
||||
|
||||
#include "../../ecs_component.h"
|
||||
#include "../../component/component_game_object.h"
|
||||
#include "../../component/action/component_return.h"
|
||||
|
||||
#define SNAKE_SPEED 1
|
||||
#define SNAKE_FRICTION 1
|
||||
#define SNAKE_VELOCITY_MAX 50
|
||||
#define SNAKE_RETURN_SPEED 1
|
||||
#define SNAKE_RETURN_VELOCITY_MAX 100
|
||||
#define SNAKE_RETURN_LIFETIME 20
|
||||
static const vec2 SNAKE_SIZE = {25.0f, 25.0f};
|
||||
|
||||
void entity_snake_init(ECS* ecs, u32 id, vec3 position);
|
||||
void entity_snake_init(ECS* ecs, u32 id, vec3 position, u32 sender);
|
||||
|
Reference in New Issue
Block a user