public TitleScene() { this.Camera.SetViewFromViewport(); m_texture = new Texture2D("Application/images/title.png", false); m_ti = new TextureInfo(m_texture); SpriteUV titleScreen = new SpriteUV(m_ti); titleScreen.Scale = m_ti.TextureSizef; titleScreen.Pivot = new Vector2(0.5f, 0.5f); titleScreen.Position = new Vector2(Director.Instance.GL.Context.GetViewport().Width / 2.0f, Director.Instance.GL.Context.GetViewport().Height / 2.0f); this.AddChild(titleScreen); Vector4 origColor = titleScreen.Color; titleScreen.Color = new Vector4(0, 0, 0, 0); var tintAction = new TintTo(origColor, 10.0f); ActionManager.Instance.AddAction(tintAction, titleScreen); tintAction.Run(); m_titleSong = new Bgm("/Application/audio/titlesong.mp3"); if (m_songPlayer != null) { m_songPlayer.Dispose(); } m_songPlayer = m_titleSong.CreatePlayer(); Scheduler.Instance.ScheduleUpdateForTarget(this, 0, false); // Clear any queued clicks so we dont immediately exit if coming in from the menu Touch.GetData(0).Clear(); }
//Accessors. //public SpriteUV SpriteTop { get{return sprites[0];} } //public SpriteUV SpriteBottom { get{return sprites[1];} } //Public functions. public Obstacle(float startX, Scene scene) { textureInfoTop = new TextureInfo("/Application/textures/toppipe.png"); textureInfoBottom = new TextureInfo("/Application/textures/bottompipe.png"); sprites = new SpriteUV[2]; //Top sprites[0] = new SpriteUV(textureInfoTop); sprites[0].Quad.S = textureInfoTop.TextureSizef; //Add to the current scene. scene.AddChild(sprites[0]); //Bottom sprites[1] = new SpriteUV(textureInfoBottom); sprites[1].Quad.S = textureInfoBottom.TextureSizef; //Add to the current scene. scene.AddChild(sprites[1]); //Get sprite bounds. Bounds2 b = sprites[0].Quad.Bounds2(); width = b.Point10.X; height = b.Point01.Y; hasPassed = false; //Position pipes. sprites[0].Position = new Vector2(startX, Director.Instance.GL.Context.GetViewport().Height *RandomPosition()); sprites[1].Position = new Vector2(startX, sprites[0].Position.Y - height - kGap); }
//Public functions. public Player(Scene scene, float floorHeight) { //Initialise Variables _frameTime = 0; _animationDelay = 3; _speed = 3.0f; _size = 115.0f; _scale = 1.00f; _angle = 0.0f; _gravity = -1.98f; _force = 25.0f; _floorHeight = floorHeight; _velocity = new Vector2(0.0f, 0.0f); _movementVector = new Vector2(0.0f, 0.0f); _jumpingVector = new Vector2(0.0f, 0.0f); _jumpVelocity = new Vector2(0.0f, 0.0f); _jump = false; _dead = false; _killed = false; _killedByFire = false; //SpriteSheet Info _textureInfo = new TextureInfo("/Application/textures/stick2.png"); _noOnSpritesheetWidth = 4; _noOnSpritesheetHeight = 2; _defaultYPos = ((_textureInfo.TextureSizef.Y / _noOnSpritesheetHeight) * _scale) * 0.5f; _widthCount = 0; _heightCount = _noOnSpritesheetHeight - 1; _fireDeathTextureInfo = new TextureInfo("/Application/textures/deathSpriteFire.png"); _noOnFDSpritesheetWidth = 4; _noOnFDSpritesheetHeight = 4; _counter = _noOnFDSpritesheetWidth * _noOnFDSpritesheetHeight; _fDwidthCount = 0; _fDheightCount = _noOnFDSpritesheetHeight - 1; //Create Sprite _sprite = new SpriteUV(); _sprite = new SpriteUV(_textureInfo); _sprite.UV.S = new Vector2(1.0f / _noOnSpritesheetWidth, 1.0f / _noOnSpritesheetHeight); _sprite.Quad.S = new Vector2(_size, _size); _sprite.Scale = new Vector2(_scale, _scale); _sprite.Position = new Vector2((Director.Instance.GL.Context.GetViewport().Width / 2) - 400, _defaultYPos + _floorHeight); _sprite.CenterSprite(); _fireDeathSprite = new SpriteUV(); _fireDeathSprite = new SpriteUV(_fireDeathTextureInfo); _fireDeathSprite.UV.S = new Vector2(1.0f / _noOnFDSpritesheetWidth, 1.0f / _noOnFDSpritesheetHeight); _fireDeathSprite.Quad.S = new Vector2(_size, _size); _fireDeathSprite.Scale = new Vector2(1.5f, 1.5f); _fireDeathSprite.Position = _sprite.Position; _fireDeathSprite.CenterSprite(); //Add to the current scene. scene.AddChild(_sprite); scene.AddChild(_fireDeathSprite); _fireDeathSprite.Visible = false; }
public void ReOrderZ(Sce.PlayStation.HighLevel.GameEngine2D.Scene scene) { sprite = null; sprite = new SpriteUV(textureInfo); sprite.Quad.S = textureInfo.TextureSizef; sprite.Position = new Vector2(0.0f, 0.0f); scene.AddChild(sprite); }
public TutorialScene() { this.Camera2D.SetViewFromViewport(); tut1 = new SpriteUV(new TextureInfo("/Application/data/tut1.png")); tut1.Scale = tut1.TextureInfo.TextureSizef; Foreground.AddChild(tut1); }
public void initVolcano() { //The basic background volcSprite = new SpriteUV(); volcTextureInfo = new TextureInfo("/Application/textures/volc2.png"); volcSprite = new SpriteUV(volcTextureInfo); volcSprite.Quad.S = volcTextureInfo.TextureSizef; }
public pointMarker(Vector2 position) { this.Position = position; this.sprite = new SpriteUV(new TextureInfo(texture)); this.sprite.Scale = new Vector2(0.75f, 0.5f); this.AddChild(this.sprite); }
public ammoMarker(Vector2 position) { this.Position = position + new Vector2(0.0f, 0.5f); this.sprite = new SpriteUV(new TextureInfo(texture)); this.sprite.Scale = new Vector2(3.0f, 1.0f); this.AddChild(this.sprite); }
public void initTitle() { this.Camera2D.SetViewFromViewport(); logo = new SpriteUV(new TextureInfo("/Application/data/logo.png")); logo.Scale = logo.TextureInfo.TextureSizef * 1.8f; logo.Pivot = new Vector2(0.5f, 0.5f); logo.Position = new Vector2((960.0f / 2.0f), (540.0f / 2.0f) + 80f); sprite_button_newgame = new SpriteUV(new TextureInfo("/Application/data/button_newgame.png")); sprite_button_newgame.Scale = sprite_button_newgame.TextureInfo.TextureSizef * 1.2f; sprite_button_newgame.Position = new Vector2((960.0f / 5.0f), (540.0f / 4.0f) - sprite_button_newgame.TextureInfo.TextureSizef.Y / 2.0f); sprite_button_tutorial = new SpriteUV(new TextureInfo("/Application/data/button_tutorial.png")); sprite_button_tutorial.Scale = sprite_button_newgame.TextureInfo.TextureSizef * 1.2f; sprite_button_tutorial.Position = new Vector2((960.0f / 2.0f), (540.0f / 4.0f) - sprite_button_newgame.TextureInfo.TextureSizef.Y / 2.0f); sprite_button_autoaim = new SpriteUV(new TextureInfo("/Application/data/button_autoaimon.png")); sprite_button_autoaim.Scale = sprite_button_newgame.TextureInfo.TextureSizef * 1.2f; sprite_button_autoaim.Position = new Vector2((960.0f / 2.0f) + (960.0f / 3.5f), (540.0f / 4.0f) - sprite_button_newgame.TextureInfo.TextureSizef.Y / 2.0f); sprite_button_newgame.Pivot = new Vector2(0.5f, 0.5f); sprite_button_autoaim.Pivot = new Vector2(0.5f, 0.5f); sprite_button_tutorial.Pivot = new Vector2(0.5f, 0.5f); Foreground.AddChild(sprite_button_newgame); Foreground.AddChild(sprite_button_tutorial); Foreground.AddChild(sprite_button_autoaim); Foreground.AddChild(logo); var tex = new Texture2D("/Application/data/tiles/simple5.png", false); var texture = new TextureInfo(tex, new Vector2i(1, 13)); menuBackground = new SpriteList(texture); int menuBackgroundWidth = 100; int menuBackgroundHeight = 50; //mini background discofloor for (int x = 0; x < 30; x++) { for (int y = 0; y < 17; y++) { SpriteTile bgTile = new SpriteTile(texture); bgTile.TileIndex1D = Support.random.Next(4, 13); bgTile.Position = new Vector2((float)x * 32.0f, (float)y * 32.0f); bgTile.Scale = bgTile.TextureInfo.TileSizeInPixelsf * 2.0f; bgTile.ScheduleInterval((dt) => { bgTile.TileIndex1D = Support.random.Next(4, 13); }, 0.2f, -1); menuBackground.AddChild(bgTile); } } Background.AddChild(menuBackground); }
//Check Level Flag Collisions public bool CheckFlagCollision(SpriteUV sprite) { bool collide = levelFlag.HasCollidedWithPlayer(sprite); if (collide) { return(true); } return(false); }
public LoadMenu(String FileName) { if (play == false) { sprite = new SpriteUV(); texInfo = new TextureInfo("/Application/textures/" + FileName + ".png"); sprite = new SpriteUV(texInfo); sprite.Quad.S = texInfo.TextureSizef; } }
public BreakableWall() : base() { breakThreshold = 50.0f; textureInfo = new TextureInfo("/Application/textures/Level/breakableWall.png"); sprite = new SpriteUV(textureInfo); sprite.Quad.S = textureInfo.TextureSizef; sprite.Pivot = new Vector2(sprite.Quad.S.X / 2, sprite.Quad.S.Y / 2); }
public static Scene MakeTestGameScene() { // System.Console.WriteLine( "MakeTestGameScene" ); var scene = new Scene() { Name = "GameScene" }; scene.Camera2D.SetViewFromWidthAndCenter(10.0f, new Vector2(3.5f, 2.6f)); PlanetCute voxel_world = new PlanetCute(new Vector3i(7, 7, 6)); SpriteUV background = new SpriteUV(); background = new SpriteUV(); // background rectangle background.BlendMode = BlendMode.None; background.TextureInfo = new TextureInfo(new Texture2D("/Application/Sample/GameEngine2D/FeatureCatalog/data/PlanetCute/bluegrad.png", false)); scene.AddChild(background); scene.RegisterDisposeOnExit((System.IDisposable)background.TextureInfo); background.Schedule((dt) => { background.Quad = new TRS(scene.Camera2D.CalcBounds()); }); /* * // ShadowSideWest test * voxel_world.SetBlock( new Vector3i(0,1,0), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(0,0,1), PlanetCute.StoneBlock ); */ /* * // ShadowWest test * voxel_world.SetBlock( new Vector3i(0,0,1), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(1,0,0), PlanetCute.StoneBlock ); */ /* * voxel_world.SetBlock( new Vector3i(0,0,1), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(1,0,1), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(2,0,1), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(0,1,1), PlanetCute.StoneBlock ); * * voxel_world.SetBlock( new Vector3i(1,1,0), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(2,1,1), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(0,2,1), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(1,2,1), PlanetCute.StoneBlock ); * voxel_world.SetBlock( new Vector3i(2,2,1), PlanetCute.StoneBlock ); */ voxel_world.CreateRPGTestScene(); scene.AddChild(voxel_world); return(scene); }
public UI() { //camera which is independent from the scene camera - means that all changes done to the underlying scene will not //change the perspective of the UI and that it will stay in place //the default view for the UI camera is ViewFromViewport - so the operational area is as big as the screen - currently 960x540 this.Camera = (ICamera)SceneManager.Instance.UICamera; this.AdHocDraw += this.Update; TextureInfo bottomBarInfo = new TextureInfo(AppMain.ttCreateTexture(1, 1, 0xFF000000)); bottomBar = new SpriteUV(bottomBarInfo); //texture is 1x1 so we need to scale it to size we want to occupy on the screen bottomBar.Scale = new Vector2(960.0f, 50.0f); TextureInfo ammoIconInfo = new TextureInfo("/Application/data/tiles/ammo.png"); ammoIcon = new SpriteUV(ammoIconInfo); ammoIcon.Scale = new Vector2(20, 20); TextureInfo heartIconInfo = new TextureInfo("/Application/data/heart.png"); heartIcon = new SpriteUV(heartIconInfo); heartIcon.Scale = new Vector2(20, 20); TextureInfo coinIconInfo = new TextureInfo("/Application/data/coin.png"); coinIcon = new SpriteUV(coinIconInfo); coinIcon.Scale = new Vector2(20, 20); //experimental fontmap Font f = new Font("/Application/data/data-latin.ttf", 15, FontStyle.Bold); FontMap fm = new FontMap(f); bottomBar.Position = new Vector2(0.0f, 0.0f); coinIcon.Position = new Vector2(176.0f, 15.0f); heartIcon.Position = new Vector2(424.0f, 15.0f); ammoIcon.Position = new Vector2(676.0f, 15.0f); scoreLabel.Position = new Vector2(200f, 20.0f); healthLabel.Position = new Vector2(450.0f, 20.0f); ammoLabel.Position = new Vector2(700.0f, 20.0f); this.AddChild(bottomBar); this.AddChild(ammoIcon); this.AddChild(heartIcon); this.AddChild(coinIcon); this.AddChild(this.ammoLabel); this.AddChild(this.healthLabel); this.AddChild(this.scoreLabel); this.Position = new Vector2(0.0f, 0.0f); }
public EnemySpawnPoint(Vector2 position) { this.Position = position; TextureInfo spawnInfo = new TextureInfo(Bullet.fireTexture); spawnSprite = new SpriteUV(spawnInfo); spawnSprite.Color = Sce.PlayStation.HighLevel.GameEngine2D.Base.Math.SetAlpha(Colors.Red, 0.0f); this.AddChild(spawnSprite); }
public Player() { texInfo = new TextureInfo("/Application/textures/spacebro2.png"); sprite = new SpriteUV(texInfo); sprite.Quad.S = texInfo.TextureSizef; sprite.Position = new Vector2(0, 0); dirState = DirState.Still; actState = ActState.Ground; walkSpeed = 2.0f; }
private void UpdateSprite(Scene scene) { _fading = false; _screen = _nextScreen; scene.RemoveChild(_bgSprite, false); switch (_screen) { case Screens.Splash: _bgTextureInfo = new TextureInfo("/Application/textures/splash.png"); _bgSprite = new SpriteUV(_bgTextureInfo); _bgSprite.Scale = new Vector2(960.0f, 544.0f); _bgSprite.Color.A = 0.0f; scene.AddChild(_bgSprite); break; case Screens.Menu: _bgTextureInfo = new TextureInfo("/Application/textures/menu.png"); _bgSprite = new SpriteUV(_bgTextureInfo); _bgSprite.Scale = new Vector2(960.0f, 544.0f); _bgSprite.Color.A = 0.0f; scene.AddChild(_bgSprite); break; case Screens.Game: _bgTextureInfo = new TextureInfo("/Application/textures/game.png"); _bgSprite = new SpriteUV(_bgTextureInfo); _bgSprite.Scale = new Vector2(960.0f, 544.0f); _bgSprite.Color.A = 0.0f; scene.AddChild(_bgSprite); AppMain.SetUISystem("game"); break; case Screens.GameOver: _bgTextureInfo = new TextureInfo("/Application/textures/gameOver.png"); _bgSprite = new SpriteUV(_bgTextureInfo); _bgSprite.Scale = new Vector2(960.0f, 544.0f); _bgSprite.Color.A = 0.0f; scene.AddChild(_bgSprite); AppMain.SetUISystem("highscores"); break; case Screens.HighScores: _bgTextureInfo = new TextureInfo("/Application/textures/highscores.png"); _bgSprite = new SpriteUV(_bgTextureInfo); _bgSprite.Scale = new Vector2(960.0f, 544.0f); _bgSprite.Color.A = 0.0f; scene.AddChild(_bgSprite); AppMain.SetUISystem("highscores"); break; } }
public Enemy() { //creates a texture for the health bar healthBar = AppMain.ttCreateTexture(16, 1, 0xff00ff00); TextureInfo tex = new TextureInfo(healthBar); healthBarSprite = new SpriteUV(tex); healthBarSprite.Quad.T = new Vector2(-0.5f, 0.5f); healthBarSprite.Quad.S = new Vector2(1.0f, 0.1f); this.AddChild(healthBarSprite); }
public Pit(Scene scene, Vector2 position) { _textureInfo = new TextureInfo("/Application/textures/Pit.png"); //Create Sprite _sprite = new SpriteUV(_textureInfo); _sprite.Quad.S = _textureInfo.TextureSizef; _sprite.Position = position; _box = _sprite.Quad.Bounds2(); scene.AddChild(_sprite); }
public Enemy(Vector2 Pos, String FileName) { texInfo = new TextureInfo("/Application/textures/" + FileName + ".png"); sprite = new SpriteUV(texInfo); sprite.Quad.S = texInfo.TextureSizef; sprite.Position = new Vector2(Pos.X, Pos.Y); moveSpeed = 2.0f; RmoveSpeed = 5.0f; min = new Vector2(sprite.Position.X, sprite.Position.Y); max = new Vector2(sprite.Position.X + 44.0f, sprite.Position.Y + 50.0f); box = new Bounds2(min, max); }
public HighscoreScene() { scene = new Sce.PlayStation.HighLevel.GameEngine2D.Scene(); scene.Camera.SetViewFromViewport(); textureInfo = new TextureInfo("/Application/Assets/Highscore.png"); background = new SpriteUV(textureInfo); background.Quad.S = textureInfo.TextureSizef; scene.AddChild(background); InitializeUI(); setScore(); }
private SpriteUV sprite; //The background sprite public Background(Scene scene, Vector2 centrePos) { backgroundTexture = new TextureInfo("/Application/textures/LevelBackgrounds/bground.png"); sprite = new SpriteUV(); sprite = new SpriteUV(backgroundTexture); sprite.Quad.S = backgroundTexture.TextureSizef; //sprite.Pivot = new Vector2(sprite.Quad.S.X, sprite.Quad.S.Y); sprite.CenterSprite(new Vector2(0.5f, 0.5f)); sprite.Position = centrePos; sprite.Angle = 0.0f; scene.AddChild(sprite); }
public TutorialManager(Scene scene) { _tutorialsEnabled = true; _popUpActive = true; _popUp = PopUp.HowToPlay; _ready = false; _popUpTextureInfo = new TextureInfo("/Application/textures/tutorial/gamePopUpTutorialsOn.png"); _popUpSprite = new SpriteUV(_popUpTextureInfo); _popUpSprite.Scale = new Vector2(800.0f, 500.0f); _popUpSprite.Position = new Vector2(80.0f, 22.0f); scene.AddChild(_popUpSprite); }
public Player(Scene scene) { textureInfo = new TextureInfo("/Application/Assets/Box2.png"); sprite = new SpriteUV(); sprite = new SpriteUV(textureInfo); sprite.Quad.S = textureInfo.TextureSizef; sprite.Position = new Vector2(500.0f, 300.0f); position = new Vector2(500.0f, 300.0f); scene.AddChild(sprite); screenHeight = Director.Instance.GL.Context.GetViewport().Height; screenWidth = Director.Instance.GL.Context.GetViewport().Width; touching = false; }
public Spikes(int spikeType) : base() { if (spikeType == 1) { textureInfo = new TextureInfo("/Application/textures/Level/smallSpikes.png"); } else if (spikeType == 2) { textureInfo = new TextureInfo("/Application/textures/Level/largeSpikes.png"); } sprite = new SpriteUV(textureInfo); sprite.Quad.S = textureInfo.TextureSizef; sprite.Pivot = new Vector2(sprite.Quad.S.X / 2, sprite.Quad.S.Y / 2); }
public GameObjectAbstract(string spriteFilePath) { TextureInfo texture_info = new TextureInfo(new Texture2D(spriteFilePath, false) ); sprite = new SpriteUV() {TextureInfo = texture_info}; sprite.Quad.S = texture_info.TextureSizef; sprite.CenterSprite(); sprite.Position = new Vector2(100,100); velocity = new Vector2(0,0); mass = 10.0f; isAlive = false; lifeTime = 0; }
public Player(Scene scene, Vector2 spawnPoint) { textureInfo = new TextureInfo("/Application/textures/ninja2.png"); //Load in our lovely duck texture sprite = new SpriteUV(); sprite = new SpriteUV(textureInfo); sprite.Quad.S = textureInfo.TextureSizef; //Might need to make smaller or bigger in the future sprite.Position = spawnPoint; //Starting position (will be changed) sprite.CenterSprite(new Vector2(0.5f, 0.5f)); //Set the origin of the sprite to the centre of the duck sprite.Scale = new Vector2(0.5f, 0.5f); sprite.Angle = 0.0f; alive = true; //Default alive true scene.AddChild(sprite); //Add our FABULOUS duck to the scene }
public void ReOrderZ(Scene scene) { sprite = null; sprite = new SpriteUV(textureInfo); sprite.Quad.S = textureInfo.TextureSizef; sprite.Position = new Vector2(0.0f, 0.0f); scene.AddChild(sprite); sprite.Visible = false; restartButtonSprite = null; restartButtonSprite = new SpriteUV(restartButtonTexture); restartButtonSprite.Quad.S = restartButtonTexture.TextureSizef; restartButtonSprite.Position = new Vector2(0.0f, 0.0f); scene.AddChild(restartButtonSprite); restartButtonSprite.Visible = false; }
public DoorObs(Scene scene, float x, float y) { doorTextureInfo = new TextureInfo("/Application/textures/door.png"); doorSprite = new SpriteUV(doorTextureInfo); doorSprite2 = new SpriteUV(doorTextureInfo); doorSprite.Quad.S = doorTextureInfo.TextureSizef; doorSprite.Position = new Vector2(x, y); doorSprite2.Quad.S = doorTextureInfo.TextureSizef; doorSprite2.Position = new Vector2(x + gap, y); scene.AddChild(doorSprite); scene.AddChild(doorSprite2); }
public Mine(float startX, float startY, Scene scene) { textureInfoMine = new TextureInfo("/Application/textures/seamine.png"); mine = new SpriteUV(textureInfoMine); mine.Quad.S = textureInfoMine.TextureSizef; scene.AddChild(mine); //Get sprite bounds. Bounds2 b = mine.Quad.Bounds2(); width = b.Point10.X; height = b.Point01.Y; mine.Position = new Vector2(startX, startY); }
//Accessors. //public SpriteUV Sprite { get{return sprite;} } //Public functions. public Bird(Scene scene) { textureInfo = new TextureInfo("/Application/textures/bird.png"); sprite = new SpriteUV(); sprite = new SpriteUV(textureInfo); sprite.Quad.S = textureInfo.TextureSizef; sprite.Position = new Vector2(50.0f, Director.Instance.GL.Context.GetViewport().Height *0.5f); //sprite.Pivot = new Vector2(0.5f,0.5f); angle = 0.0f; rise = false; alive = true; //Add to the current scene. scene.AddChild(sprite); }