public Meteor(Scene scene, Vector2 position) { meteorBroken = false; sizeX = 160.0f; sizeY = 333.0f; frameTime = 0; animationDelay = 3; widthCount = 0; //Line sprite initialise lineTextureInfo = new TextureInfo("/Application/textures/meteorLine.png"); lineSprite = new SpriteUV(lineTextureInfo); lineSprite.Position = new Vector2(position.X, position.Y - 544.0f); //Meteor sprite initialise meteorTextureInfo = new TextureInfo("/Application/textures/meteorSprite.png"); noOnSpritesheetWidth = 4; meteorSprite = new SpriteUV(meteorTextureInfo); meteorSprite.UV.S = new Vector2(1.0f / noOnSpritesheetWidth, 1.0f); meteorSprite.Position = position; meteorSprite.Quad.S = new Vector2(160, 333); Bounds2 meteorBounds = meteorSprite.Quad.Bounds2(); // Add sprites to scene scene.AddChild(meteorSprite); scene.AddChild(lineSprite); }
public void addUnderFloor(Scene scene) { scene.AddChild(underFloorSprite); scene.AddChild(underFloor2Sprite); scene.AddChild(floorLavaOverlay); scene.AddChild(floorLava2Overlay); }
//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; }
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 void addToScene(Scene scene) { //Add to the current scene. scene.AddChild(volcSprite); scene.AddChild(smogSprite); scene.AddChild(smogSprite2); scene.AddChild(wallSprite); scene.AddChild(wallSprite2); scene.AddChild(entrSprite); scene.AddChild(floorOverlay); scene.AddChild(floor2Overlay); scene.AddChild(floorSprite); scene.AddChild(floor2Sprite); }
public Trap(Scene scene, Vector2 position) { _textureInfo = new TextureInfo("/Application/textures/TrapSpriteSheet.png"); _noOnSpritesheetWidth = 4; _noOnSpritesheetHeight = 3; _noOnSpritesheet = 11; _widthCount = 0; _heightCount = _noOnSpritesheetHeight - 1; _animationDelay = 4; _counter = 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.Quad.S = new Vector2(_textureInfo.TextureSizef.X / _noOnSpritesheetWidth, _textureInfo.TextureSizef.Y / _noOnSpritesheetHeight); _sprite.Position = position; _box = _sprite.Quad.Bounds2(); scene.AddChild(_sprite); }
//Public functions. public SpinObstacle(Scene scene, Vector2 position) { textureSpinObstacle = new TextureInfo("/Application/textures/firebeam.png"); textureSpinPiv = new TextureInfo("/Application/textures/piv.png"); pivSprite = new SpriteUV[numberOfObstacles]; spinSprite = new SpriteUV[numberOfObstacles]; for (int i = 0; i < numberOfObstacles; i++) { pivSprite[i] = new SpriteUV(textureSpinPiv); pivSprite[i].Quad.S = textureSpinPiv.TextureSizef; pivSprite[i].CenterSprite(); pivSprite[i].Position = new Vector2(position.X + (100 + i * 200.0f), Director.Instance.GL.Context.GetViewport().Height *0.45f); spinSprite[i] = new SpriteUV(textureSpinObstacle); spinSprite[i].Quad.S = textureSpinObstacle.TextureSizef; spinBounds = spinSprite[i].Quad.Bounds2(); spinSprite[i].CenterSprite(); spinSprite[i].Position = pivSprite[i].Position; //scene.AddChild(pivSprite[i]); scene.AddChild(spinSprite[i]); } spinSprite[0].Angle = 2.12f; spinSprite[1].Angle = 1.02f; spinSprite[2].Angle = 2.12f; }
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); }
private static Vector2 newTouchPos = new Vector2(0.0f, 0.0f); // Position of last touch on screen public ObstacleSeasaw(Scene scene) { //Initialise Variables _scale = 1.00f; _rotationSpeed = -0.015f; _rotateLeft = false; //SpriteSheet Info _textureInfo = new TextureInfo("/Application/textures/Seasaw.png"); //Create Sprite _sprite = new SpriteUV(); _sprite = new SpriteUV(_textureInfo); _sprite.Quad.S = _textureInfo.TextureSizef; _sprite.Scale = new Vector2(_scale, _scale); _sprite.CenterSprite(); _sprite.Position = new Vector2(400.0f, 70.0f); _hypotenuse = (_textureInfo.TextureSizef.X * _scale); _angle = 0.55f; _angle2 = (float)((System.Math.PI / 2) - _angle); _opposite = (float)System.Math.Cos(_angle2) * _hypotenuse; _adjacent = (float)System.Math.Tan(_angle) * _opposite; _sprite.Angle = _angle; //Add to the current scene. scene.AddChild(_sprite); }
public Spring(Scene scene, Vector2 position) { rand = new Random(); springReleased = false; missedSpring = false; beingPushed = false; magmaTrap = true; // Initialise spring texture and sprite, get bounds and set position minus height offset springTextureInfo = new TextureInfo("/Application/textures/Spring.png"); springSprite = new SpriteUV(springTextureInfo); springSprite2 = new SpriteUV(springTextureInfo); springSprite.Quad.S = springTextureInfo.TextureSizef; springSprite2.Quad.S = springTextureInfo.TextureSizef; Bounds2 springBounds = springSprite.Quad.Bounds2(); springWidth = springBounds.Point10.X; springOriginalHeight = springBounds.Point01.Y; springCurrentHeight = springBounds.Point01.Y; // Initialise spring texture and sprite, get bounds and set position minus height offset springTopTextureInfo = new TextureInfo("/Application/textures/SpringTop.png"); springTopSprite = new SpriteUV(springTopTextureInfo); springTopSprite.Quad.S = springTopTextureInfo.TextureSizef; Bounds2 springTopBounds = springTopSprite.Quad.Bounds2(); springTopHeight = springTopBounds.Point01.Y; springTopWidth = springTopBounds.Point10.X; float sizeDifference = 12; // Spring width is 100, spring top is 76, half it for x offset springSprite.Position = new Vector2(position.X, position.Y); springSprite2.Position = springSprite.Position + new Vector2(58.0f, 48.0f); // Offset second spring for 3d effect trap = new Trap(scene, new Vector2((position.X + 125 + sizeDifference), 60)); pit = new Pit(scene, new Vector2((position.X + 125 + sizeDifference), 60)); springTopSprite.Position = new Vector2(position.X + sizeDifference, springSprite.Position.Y + springBounds.Point01.Y - 20); // Add sprites to scene scene.AddChild(springSprite); scene.AddChild(springSprite2); scene.AddChild(springTopSprite); }
//Public functions. public BrokenBridge(Scene scene, Vector2 position) { touching = false; missedBridge = true; trap = new Trap(scene, position); position = new Vector2(position.X, 470); texturePlank = new TextureInfo("/Application/textures/plank5.png"); plankSprite = new SpriteUV(texturePlank); plankSprite.Quad.S = texturePlank.TextureSizef; plankBounds = plankSprite.Quad.Bounds2(); plankSprite.Position = position; // Offset rope positions for each corner by moving them in a little // Update Bounds 5=paddding, 50 = 3D offset. Right side moved in extra ropeBLOffset = plankBounds.Point00 + new Vector2(5, 5); ropeBROffset = plankBounds.Point10 + new Vector2(-65, 5); ropeTLOffset = plankBounds.Point01 + new Vector2(55, -5); ropeTROffset = plankBounds.Point11 + new Vector2(-25, -5); textureRope = new TextureInfo("/Application/textures/ropedone.png"); ropeSprite1 = new SpriteUV(textureRope); ropeSprite1.Quad.S = textureRope.TextureSizef; ropeSprite1.Position = position + ropeBLOffset; ropeSprite2 = new SpriteUV(textureRope); ropeSprite2.Quad.S = textureRope.TextureSizef; ropeSprite2.Position = position + ropeTLOffset; ropeSprite3 = new SpriteUV(textureRope); ropeSprite3.Quad.S = textureRope.TextureSizef; ropeSprite3.Position = position + ropeTROffset; ropeSprite4 = new SpriteUV(textureRope); ropeSprite4.Quad.S = textureRope.TextureSizef; ropeSprite4.Position = position + ropeBROffset; scene.AddChild(plankSprite); scene.AddChild(ropeSprite1); scene.AddChild(ropeSprite2); scene.AddChild(ropeSprite3); scene.AddChild(ropeSprite4); }
public Geiser(Scene scene, Vector2 position) { spikeBroken = false; sizeX = 116.6f; sizeY = 240.0f; frameTime = 0; animationDelay = 3; widthCount = 0; geiserOn = true; //Geiser sprite initialise /width of each geiser is 116.6px geiserSheetTextureInfo = new TextureInfo("/Application/textures/geiserSpriteSheet.png"); noOnSpritesheetWidth = 8; geiserTextureInfo = new TextureInfo("/Application/textures/geiser.png"); //defaultXPos = ((textureInfo.TextureSizef.X/noOnGeiserSheetWidth)*1.00f)*0.5f; geiserSpriteSheet = new SpriteUV(geiserSheetTextureInfo); geiserSpriteSheet.UV.S = new Vector2(1.0f / noOnSpritesheetWidth, 1.0f); geiserSprite = new SpriteUV(geiserTextureInfo); geiserSpriteSheet.Position = position; geiserSpriteSheet.Quad.S = new Vector2(116, 240); geiserSpriteSheet.Scale = new Vector2(1.0f, 1.0f); Bounds2 geiserBounds = geiserSpriteSheet.Quad.Bounds2(); geiserSprite.Position = new Vector2(geiserSpriteSheet.Position.X, geiserSpriteSheet.Position.Y); geiserSprite.Scale = new Vector2(117.0f, 240.0f); //Spike sprite initialise spikeTextureInfo = new TextureInfo("/Application/textures/stalactite.png"); spikeSprite = new SpriteUV(spikeTextureInfo); spikeSprite.UV.S = new Vector2(0.5f, 1.0f); spikeSprite.Quad.S = new Vector2(58, 78); spikeBounds = spikeSprite.Quad.Bounds2(); spikeSprite.Position = new Vector2(position.X + 6 + spikeBounds.Point10.X / 2, geiserSpriteSheet.Position.Y + 475); spikeSprite.Scale = new Vector2(1.0f, 1.0f); // Add sprites to scene scene.AddChild(geiserSpriteSheet); scene.AddChild(spikeSprite); scene.AddChild(geiserSprite); }
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 void DisableTutorials(Scene scene) { _ready = false; _tutorialsEnabled = !_tutorialsEnabled; scene.RemoveChild(_popUpSprite, false); if (_tutorialsEnabled) { _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); } else { _popUpTextureInfo = new TextureInfo("/Application/textures/tutorial/gamePopUpTutorialsOff.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 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 ScreenManager(Scene scene) { _screen = Screens.Splash; _nextScreen = Screens.Splash; _transitioning = true; _fading = false; _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); }
public Seasaw(Scene scene, float xPos, float floorHeight) { //Initialise Variables rand = new Random(); _scale = 1.00f; _rotationSpeed = 0.01f; _scaleLimiter = 0.3f; _tempScale = 1.0f; _rotateLeft = false; _onObstacle = false; _floorHeight = floorHeight; _defaultYPos = floorHeight + 45.0f; //SpriteSheet Info _textureInfo = new TextureInfo("/Application/textures/Seasaw.png"); //Create Sprite _sprite = new SpriteUV(); _sprite = new SpriteUV(_textureInfo); _sprite.Quad.S = _textureInfo.TextureSizef; _sprite.Scale = new Vector2(_scale, _scale); _sprite.CenterSprite(); _sprite.Position = new Vector2(xPos + 180, _defaultYPos); _hypotenuse = (_textureInfo.TextureSizef.X * _scale); _angle = -0.32f; _angle2 = (FMath.PI / 2) - _angle; _opposite = FMath.Cos(_angle2) * _hypotenuse; _adjacent = FMath.Tan(_angle) * _opposite; _sprite.Angle = _angle; _scalerValue = _tempScale / (_angle * 10); _trap = new Trap(scene, new Vector2(xPos, 60.0f)); _pit = new Pit(scene, new Vector2(xPos, 60)); //Add to the current scene. scene.AddChild(_sprite); }
public void ClosePopUp(Scene scene) { _ready = false; if (_tutorialsEnabled) { scene.RemoveChild(_popUpSprite, false); // Load next popup switch (_popUp) { case PopUp.HowToPlay: _popUpTextureInfo.Dispose(); _popUpTextureInfo = new TextureInfo("/Application/textures/tutorial/springPopUp.png"); _popUpSprite = new SpriteUV(_popUpTextureInfo); _popUpSprite.Scale = new Vector2(800.0f, 500.0f); _popUpSprite.Position = new Vector2(80.0f, 22.0f); scene.AddChild(_popUpSprite); _popUp = PopUp.Spring; break; case PopUp.Spring: _popUpTextureInfo.Dispose(); _popUpTextureInfo = new TextureInfo("/Application/textures/tutorial/seaSawPopUp.png"); _popUpSprite = new SpriteUV(_popUpTextureInfo); _popUpSprite.Scale = new Vector2(800.0f, 500.0f); _popUpSprite.Position = new Vector2(80.0f, 22.0f); scene.AddChild(_popUpSprite); _popUp = PopUp.Seasaw; break; case PopUp.Seasaw: _popUpTextureInfo.Dispose(); _popUpTextureInfo = new TextureInfo("/Application/textures/tutorial/spinningPopUp.png"); _popUpSprite = new SpriteUV(_popUpTextureInfo); _popUpSprite.Scale = new Vector2(800.0f, 500.0f); _popUpSprite.Position = new Vector2(80.0f, 22.0f); scene.AddChild(_popUpSprite); _popUp = PopUp.Spinning; break; case PopUp.Spinning: _popUpTextureInfo.Dispose(); _popUpTextureInfo = new TextureInfo("/Application/textures/tutorial/geiserPopUp.png"); _popUpSprite = new SpriteUV(_popUpTextureInfo); _popUpSprite.Scale = new Vector2(800.0f, 500.0f); _popUpSprite.Position = new Vector2(80.0f, 22.0f); scene.AddChild(_popUpSprite); _popUp = PopUp.Geiser; break; case PopUp.Geiser: _popUpTextureInfo.Dispose(); _popUpTextureInfo = new TextureInfo("/Application/textures/tutorial/tntPopUp.png"); _popUpSprite = new SpriteUV(_popUpTextureInfo); _popUpSprite.Scale = new Vector2(800.0f, 500.0f); _popUpSprite.Position = new Vector2(80.0f, 22.0f); scene.AddChild(_popUpSprite); _popUp = PopUp.TNT; break; case PopUp.TNT: // Last tutorial = remove sprite _popUpActive = false; scene.RemoveChild(_popUpSprite, false); break; } } else // Tutorials have been disabled, don't display them { _popUpActive = false; scene.RemoveChild(_popUpSprite, false); } }