Go to File - New level - Empty level
Create a Box from the BSP category
Make its location 0.0, 0.0, 0.0
Use the image template and drag it into context
Go to File and Save all as P1_Main
Go to Edit - Project settings - Maps and modes
Set the Game default map and Editor startup map to P1_Main
Right click in content, create new material and name it M_Reference
Double click on the material
Hold T and left click
Name the texture, PongTexture
Drag the white pin into Emissive colour
Change the shading to Unlit
Apply
Drag reference onto box
Change the Y to 1290 and X to 900
Go into M_Reference, right click and add a BoundingBoxBased_0_1_UVW
Drag the result out and create a Component Mask
Then drag out from this and create a Custom Rotator
Hold 1 and left click to create a numeric value
Make the value 0.75 and connect this to the Custom Rotator
Return to the P1_Main and create another BSP Box
Make its dimensions 100 by 100 by 100
Right click on this box and Create Static Mesh
Name this SM_Ball
Create another BSP Box and make it 350 by 100 by 100
Create a static mesh from this and name it SM_Paddle
Create another BSP Box and make it 150 by 5100 by 100
From this make a static mesh called SM_Boundary
Create a Text Render, drag it onto the scene and drag it 90 degrees down and 180 degrees around
Change its World Size to 820, its Horizontal Alignment to Centre and Vertical Alignment to Text Centre
Type "0" in Text
Hold Alt and drag it across to duplicate it
Name one P1_Score_Text and the other P2_Score_Text
Right click in Content and create 5 new folders, then move all assets to the corresponding folders
Folders:
- StaticMeshes
- Levels
- Textures
- Materials
- Blueprints
Go into Blueprint, right click and create Blueprint Class, then create a Pawn and name it BP_Paddle_Pawn_Right
Enter the Viewport, go to Add Component - Static Mesh, then choose Paddle _Mesh
Enter the Static Mesh tab, click None and change it to SM_Paddle
Double click on the Static Mesh
Click Collision and choose Box Simplified Collision
Look to the right hand side window
Switch on Simulate Physics and switch off Enable Gravity
Set Linear Damping to 10.0
Compile
Go to Edit - Project Settings - Input
Create a new Axis Mappings called P1_MoveUp
Tab down and create Up (1) and Down (-1)
Enter Paddle Pawn
Right click, make P1_MoveUp and drag off it to create MakeVector
Right click, make AddForce(Paddle_Mesh) and connect this to Event Tick
Right click, MakeVector and connect to Force
Right click, type * and enter 30,000
Enter Blueprint, RC, create BP Class - Game Mode and name it BP_PongGameMode
Change default to Paddle_Pawn
Go to Edit - Project Settings - Input - Maps and Modes
Change the Game Default to P1_Main and Default Game Mode to BP_PongGame
CAMERA
Search for Camera, select unlit and drag onto the workspace
Drag it 90 degrees down so it is facing the board
Then pull it up so the entire boards fits in the shot
Click on the camera, click blueprints then open level blueprint
Right click and create Reference to Camera Actor (must have context sensitive on)
Right click and create Set View Target with Blend (must have context sensitive off) and plug this into Event Begin Play
Create Get Player Controller and plug into Target
Plug Camera Actor into New View Target
Change it to an Orthographic camera (camera settings - perspective)
Go into Materials, right click and create a custom material, name it M_UnlitWhite
Go into this material, hold 1 and left click, change the value to 1.0
Plug this node into Emissive Colour
Turn the shading model to unlit
Return to main page and open Static Meshes
Change the World Grid material to UnlitWhite
PADDLE
From Event Tick create an Add Force node
Get P1_MoveUp target (return value) - X (10,000,000) - Make Vector (X) - Add Force (Force)
No comments:
Post a Comment