-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLevelHelper.cs
41 lines (30 loc) · 1.16 KB
/
LevelHelper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using FNAEngine2D;
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Pong
{
public static class LevelHelper
{
/// <summary>
/// Épaisseur des murs virtuels
/// </summary>
public const int SIDE_WIDTH = 24;
public const int GAME_WIDTH = 600;
/// <summary>
/// Permet d'ajouter les sides par défaut
/// </summary>
public static void AddSidesDefault(GameObject gameObject)
{
int leftSide = (gameObject.Game.Width / 2) - (GAME_WIDTH / 2);
int rightSide = (gameObject.Game.Width / 2) + (GAME_WIDTH / 2);
gameObject.Add(new GameBorder("side", new Rectangle(leftSide - SIDE_WIDTH, 0, SIDE_WIDTH, gameObject.Game.Height)));
gameObject.Add(new GameBorder("side", new Rectangle(rightSide, 0, SIDE_WIDTH, gameObject.Game.Height)));
gameObject.Add(new GameBorder("top", new Rectangle(leftSide - SIDE_WIDTH, 0, GAME_WIDTH + (SIDE_WIDTH * 2), SIDE_WIDTH)));
gameObject.Add(new Bottom());
}
}
}