94 lines
2.6 KiB
C++
94 lines
2.6 KiB
C++
#pragma once
|
|
|
|
#include "Components.hpp"
|
|
#include "Entity.hpp"
|
|
#include <memory>
|
|
|
|
std::shared_ptr<Entity> CreateProbe() {
|
|
auto e = std::make_shared<Entity>();
|
|
auto &transform = e->AddComponent<TransformComponent>();
|
|
transform.x = 96.0f;
|
|
transform.y = 230.0f;
|
|
|
|
e->AddComponent<GravityReceiverComponent>();
|
|
|
|
auto &physics = e->AddComponent<PhysicsComponent>();
|
|
physics.vx = 108.0f;
|
|
physics.vy = 0.0f;
|
|
physics.speedCap = 8192.0f;
|
|
|
|
e->AddComponent<ColliderComponent>();
|
|
e->AddComponent<TrailComponent>();
|
|
e->AddComponent<ProjectionComponent>();
|
|
e->AddComponent<RenderComponent>();
|
|
return e;
|
|
}
|
|
|
|
std::shared_ptr<Entity> CreateGravityWell() {
|
|
auto e = std::make_shared<Entity>();
|
|
auto &transform = e->AddComponent<TransformComponent>();
|
|
transform.x = 96.0f;
|
|
transform.y = 230.0f;
|
|
|
|
auto &well = e->AddComponent<GravityWellComponent>();
|
|
well.mass = (float)(1 << 22);
|
|
well.minDist = 28.0f;
|
|
well.followLerp = 12.0f;
|
|
|
|
e->AddComponent<RenderComponent>();
|
|
return e;
|
|
}
|
|
|
|
std::shared_ptr<Entity> CreateStar(float x, float y) {
|
|
auto e = std::make_shared<Entity>();
|
|
auto &t = e->AddComponent<TransformComponent>();
|
|
t.x = x;
|
|
t.y = y;
|
|
auto &scrollable = e->AddComponent<ScrollableComponent>();
|
|
scrollable.worldX = x;
|
|
e->AddComponent<ColliderComponent>();
|
|
e->AddComponent<CollectibleComponent>();
|
|
e->AddComponent<RenderComponent>();
|
|
return e;
|
|
}
|
|
|
|
std::shared_ptr<Entity> CreateAsteroid(float x, float y) {
|
|
auto e = std::make_shared<Entity>();
|
|
auto &t = e->AddComponent<TransformComponent>();
|
|
t.x = x;
|
|
t.y = y;
|
|
auto &scrollable = e->AddComponent<ScrollableComponent>();
|
|
scrollable.worldX = x;
|
|
e->AddComponent<ColliderComponent>();
|
|
e->AddComponent<RenderComponent>();
|
|
return e;
|
|
}
|
|
|
|
std::shared_ptr<Entity> CreateNullZone(float x, float width) {
|
|
auto e = std::make_shared<Entity>();
|
|
auto &t = e->AddComponent<TransformComponent>();
|
|
t.x = x;
|
|
auto &scrollable = e->AddComponent<ScrollableComponent>();
|
|
scrollable.worldX = x;
|
|
|
|
auto &nullZone = e->AddComponent<NullZoneComponent>();
|
|
nullZone.width = width;
|
|
e->AddComponent<RenderComponent>();
|
|
return e;
|
|
}
|
|
|
|
std::shared_ptr<Entity> CreateWorld() {
|
|
auto e = std::make_shared<Entity>();
|
|
e->AddComponent<ScrollComponent>();
|
|
e->AddComponent<SpawnComponent>();
|
|
return e;
|
|
}
|
|
|
|
std::shared_ptr<Entity> CreateHUD() {
|
|
auto e = std::make_shared<Entity>();
|
|
e->AddComponent<MeterComponent>();
|
|
e->AddComponent<HudComponent>();
|
|
e->AddComponent<RenderComponent>();
|
|
return e;
|
|
}
|