feat: Added Ball GameObject
This commit is contained in:
parent
1645e028f2
commit
49566e6981
|
@ -37,8 +37,14 @@ public class Game1 : Game
|
||||||
{
|
{
|
||||||
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
_spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||||
|
|
||||||
Texture2D texture2D = Content.Load<Texture2D>("Sprites/Pixel");
|
Sprite spriteBox = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Pixel") };
|
||||||
Sprite sprite = new Sprite() { Texture2D = texture2D };
|
Sprite spriteBall = new Sprite() { Texture2D = Content.Load<Texture2D>("Sprites/Circle") };
|
||||||
|
|
||||||
|
IGameObject gameObjectBall = gameManager.InstantiateGameObject<GameObject>();
|
||||||
|
gameObjectBall.Name = "Ball";
|
||||||
|
gameObjectBall.Transform.Position = new Vector2(Window.ClientBounds.Width * .5f, Window.ClientBounds.Height * .5f);
|
||||||
|
gameObjectBall.Transform.Scale = new Vector2(.025f, .025f);
|
||||||
|
gameObjectBall.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(spriteBall);
|
||||||
|
|
||||||
IGameObject gameObjectLeft = gameManager.InstantiateGameObject<GameObject>();
|
IGameObject gameObjectLeft = gameManager.InstantiateGameObject<GameObject>();
|
||||||
gameObjectLeft.Name = "Left";
|
gameObjectLeft.Name = "Left";
|
||||||
|
@ -46,7 +52,7 @@ public class Game1 : Game
|
||||||
gameObjectLeft.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f);
|
gameObjectLeft.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f);
|
||||||
gameObjectLeft.BehaviourController.AddBehaviour<KeyboardInputsBehaviour>();
|
gameObjectLeft.BehaviourController.AddBehaviour<KeyboardInputsBehaviour>();
|
||||||
gameObjectLeft.BehaviourController.AddBehaviour<MovementBehaviour>(Keys.S, Keys.W, 200f);
|
gameObjectLeft.BehaviourController.AddBehaviour<MovementBehaviour>(Keys.S, Keys.W, 200f);
|
||||||
gameObjectLeft.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(sprite);
|
gameObjectLeft.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(spriteBox);
|
||||||
|
|
||||||
IGameObject gameObjectRight = gameManager.InstantiateGameObject<GameObject>();
|
IGameObject gameObjectRight = gameManager.InstantiateGameObject<GameObject>();
|
||||||
gameObjectRight.Name = "Right";
|
gameObjectRight.Name = "Right";
|
||||||
|
@ -54,7 +60,7 @@ public class Game1 : Game
|
||||||
gameObjectRight.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f);
|
gameObjectRight.Transform.Scale = new Vector2(Window.ClientBounds.Width * .02f, Window.ClientBounds.Height * .15f);
|
||||||
gameObjectRight.BehaviourController.AddBehaviour<KeyboardInputsBehaviour>();
|
gameObjectRight.BehaviourController.AddBehaviour<KeyboardInputsBehaviour>();
|
||||||
gameObjectRight.BehaviourController.AddBehaviour<MovementBehaviour>(Keys.Down, Keys.Up, 200f);
|
gameObjectRight.BehaviourController.AddBehaviour<MovementBehaviour>(Keys.Down, Keys.Up, 200f);
|
||||||
gameObjectRight.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(sprite);
|
gameObjectRight.BehaviourController.AddBehaviour<DisplayableSpriteBehaviour>().Assign(spriteBox);
|
||||||
// TODO: use this.Content to load your game content here
|
// TODO: use this.Content to load your game content here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue