mirror of
https://github.com/kuhyx/praca_magisterska.git
synced 2026-07-04 13:23:05 +02:00
3.6 KiB
3.6 KiB
Part 8: Create Game Mode and Level
← Previous: Part 7 - Score Manager / UI | Back to Index | Next: Part 9 - Final Setup and Testing →
Step 8.1: Create Custom Game Mode
-
Content Browser → Blueprints
-
Right-click → Blueprint Class
-
In popup, expand "All Classes"
-
Search for "Game Mode Base"
-
Select "Game Mode Base" and click Select
-
Name:
BP_BulletHellGameMode -
Double-click to open
-
In the Details panel (with BP_BulletHellGameMode open):
- Find "Classes" section
- Default Pawn Class: Select
BP_Player - Player Controller Class: Keep default
Expected Result after Compile
- Compile button shows GREEN checkmark
- Details panel shows "Default Pawn Class" set to BP_Player
Step 8.2: Configure Project to Use Game Mode
- Go to Edit → Project Settings
- In left sidebar, click "Maps & Modes"
- Under "Default Modes":
- Default GameMode: Select
BP_BulletHellGameMode
- Default GameMode: Select
- Close Project Settings
Expected Result
- Project Settings shows BP_BulletHellGameMode as Default GameMode
- This means the game will automatically spawn BP_Player when Play is pressed
Step 8.3: Create Game Level
- File → New Level
- Select "Empty Level"
- File → Save Current Level As
- Navigate to Content folder
- Name:
BulletHellLevel - Click Save
Expected Result
- New level file "BulletHellLevel" appears in Content folder
- Level is completely empty (black viewport)
- Outliner shows only default actors (if any)
Step 8.4: Set Up Level Components
In the level (main viewport), we need to add game actors:
1. ADD CAMERA
- In Place Actors panel (left side, or Window → Place Actors)
- Search for "Camera Actor"
- Drag into viewport
- Position camera:
- In Details panel, under Transform:
- Location:
X=0, Y=0, Z=1000 - Rotation:
X=-90, Y=0, Z=0(looking down)
- Set as default camera:
- In Details panel, find "Auto Activate for Player"
- Check the box, set Player Index to
0
For Orthographic View:
- Click on Camera component
- In Details, set "Projection Mode" to
Orthographic - Set "Ortho Width" to
1920(or your screen width)
2. ADD PLAYER
- From Content Browser, drag
BP_Playerinto level - Position:
X=0, Y=-300, Z=0(bottom center)
3. ADD ENEMY SPAWNER
- Drag
BP_EnemySpawnerinto level - Position:
X=0, Y=500, Z=0(top of screen) - In Details panel, set EnemyClass to
BP_Enemy
4. ADD GAME DIRECTOR
- Drag
BP_GameDirectorinto level - Position doesn't matter (it's invisible)
5. ADD SCORE MANAGER
- Drag
BP_ScoreManagerinto level - Position doesn't matter
6. Save the level (Ctrl+S)
Expected Result in Level Viewport
- Camera actor visible at top of scene (Z=1000)
- BP_Player visible at bottom center (Y=-300)
- BP_EnemySpawner visible at top (Y=500)
- BP_GameDirector and BP_ScoreManager in Outliner (invisible actors)
Expected Result in Outliner
- CameraActor
- BP_Player
- BP_EnemySpawner
- BP_GameDirector
- BP_ScoreManager
Step 8.5: Set Default Level
- Edit → Project Settings
- Maps & Modes
- Under "Default Maps":
- Editor Startup Map: Select
BulletHellLevel - Game Default Map: Select
BulletHellLevel
- Editor Startup Map: Select
Expected Result
- Project Settings shows BulletHellLevel as both startup and default map
- Launching the game (standalone or in editor) loads this level automatically
← Previous: Part 7 - Score Manager / UI | Back to Index | Next: Part 9 - Final Setup and Testing →