R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
CollisionLayers.hpp
Go to the documentation of this file.
1/*
2** EPITECH PROJECT, 2025
3** RTYPE
4** File description:
5** CollisionLayers - Collision layer and mask constants
6*/
7
8#pragma once
9
10#include <cstdint>
11
12namespace ecs {
20 namespace CollisionLayers {
21 // Layer definitions (single bit each)
22 constexpr std::uint32_t PLAYER = (1 << 0); // 0x00000001
23 constexpr std::uint32_t ENEMY = (1 << 1); // 0x00000002
24 constexpr std::uint32_t PLAYER_PROJECTILE = (1 << 2); // 0x00000004
25 constexpr std::uint32_t ENEMY_PROJECTILE = (1 << 3); // 0x00000008
26 constexpr std::uint32_t WALL = (1 << 4); // 0x00000010
27 constexpr std::uint32_t COLLECTIBLE = (1 << 5); // 0x00000020
28 constexpr std::uint32_t PLAYER_MODULE = (1 << 6); // 0x00000040 - Orbital drones
29
30 // Common collision masks (combine multiple layers)
31 constexpr std::uint32_t MASK_ALL = 0xFFFFFFFF;
32 constexpr std::uint32_t MASK_NONE = 0x00000000;
33
34 // Player collides with: enemies, enemy projectiles, walls, collectibles
35 constexpr std::uint32_t MASK_PLAYER = ENEMY | ENEMY_PROJECTILE | WALL | COLLECTIBLE;
36
37 // Enemy collides with: players, player projectiles, player modules
38 constexpr std::uint32_t MASK_ENEMY = PLAYER | PLAYER_PROJECTILE | PLAYER_MODULE;
39
40 // Player projectile collides with: enemies, walls
41 constexpr std::uint32_t MASK_PLAYER_PROJECTILE = ENEMY | WALL;
42
43 // Enemy projectile collides with: players, player modules, walls
44 constexpr std::uint32_t MASK_ENEMY_PROJECTILE = PLAYER | PLAYER_MODULE | WALL;
45
46 // Wall collides with: everything except collectibles
47 constexpr std::uint32_t MASK_WALL = PLAYER | ENEMY | PLAYER_PROJECTILE | ENEMY_PROJECTILE;
48
49 // Collectible collides with: players only
50 constexpr std::uint32_t MASK_COLLECTIBLE = PLAYER;
51
52 // Player module collides with: enemies and enemy projectiles
53 constexpr std::uint32_t MASK_PLAYER_MODULE = ENEMY | ENEMY_PROJECTILE;
54 } // namespace CollisionLayers
55} // namespace ecs
Collision layer constants for entity filtering.
constexpr std::uint32_t MASK_WALL
constexpr std::uint32_t PLAYER_MODULE
constexpr std::uint32_t COLLECTIBLE
constexpr std::uint32_t MASK_PLAYER
constexpr std::uint32_t ENEMY_PROJECTILE
constexpr std::uint32_t MASK_NONE
constexpr std::uint32_t MASK_PLAYER_PROJECTILE
constexpr std::uint32_t MASK_ENEMY
constexpr std::uint32_t MASK_ALL
constexpr std::uint32_t WALL
constexpr std::uint32_t MASK_COLLECTIBLE
constexpr std::uint32_t ENEMY
constexpr std::uint32_t PLAYER
constexpr std::uint32_t PLAYER_PROJECTILE
constexpr std::uint32_t MASK_ENEMY_PROJECTILE
constexpr std::uint32_t MASK_PLAYER_MODULE
Maximum number of distinct component types supported by the Registry.
Definition GameLogic.hpp:26