public override void OnExit() { _okButton.ButtonUpAction -= Handle_okButtonButtonUpAction; _okButton = null; circleOneImg = null; circleTwoImg = null; circleThreeImg = null; wildcardImg = null; cubeOneTop = null; cubeOneRight = null; cubeOneLeft = null; heartOne = null; heartTwo = null; heartThree = null; strikeFour = null; heartFive = null; heartSix = null; plus = null; arrow = null; cubeTwoTop = null; cubeTwoRight = null; cubeTwoLeft = null; instructionOneLabel = null; instructionTwoLabel = null; instructionThreeLabel = null; RemoveAllChildren(true); }
public static Sce.PlayStation.HighLevel.GameEngine2D.SpriteTile SpriteFromFile(string filename) { if (TextureCache.ContainsKey(filename) == false) { TextureCache[filename] = new Texture2D(filename, false); TextureInfoCache[filename] = new TextureInfo(TextureCache[filename], new Vector2i(1, 1)); } var tex = TextureCache[filename]; var info = TextureInfoCache[filename]; // Vector2i tilesize=new Vector2i(256,256); // if ( info.TextureSize ) // { // } var result = new Sce.PlayStation.HighLevel.GameEngine2D.SpriteTile() { TextureInfo = info, }; result.Quad.S = new Vector2(info.Texture.Width, info.Texture.Height); // result.Quad.S = info.TextureSizef; // DEBUG: testing for current assets result.Scale = new Vector2(1.0f); tex.SetFilter(DefaultTextureFilterMode); return result; }
public FishEnemy(Vector2 pos, PlayerCreature player) { enemyHabitat = Enemy.EnemyHabitat.ENEMY_HABITAT_SEA; enemyType = Enemy.EnemyType.ENEMY_TYPE_FISH; sprite = new SpriteTile(); this.player = player; if (texInfo == null) { //texInfo = new TextureInfo ("/Application/assets/stingray_float.png"); texInfo = new TextureInfo(AssetManager.GetTexture("stingray_float"), new Vector2i(4,1),TRS.Quad0_1); } if (spriteList == null) { spriteList = new SpriteList(texInfo); } spriteList.Position = new Vector2(0.0f,0.0f); spriteList.AddChild(sprite); Animations = new Dictionary<string, Animation>(); //texInfo = new TextureInfo(AssetManager.GetTexture("stingray_float"), new Vector2i(4,1),TRS.Quad0_1); Animations.Add("idle" , new Animation(0, 3, 0.3f, false)); CurrentAnimation = Animations["idle"]; CurrentAnimation.Play(); sprite.GetContentWorldBounds(ref boundingBox); sprite.Quad.S = new Vector2(321, 270);// map 1:1 on screen -- necessary? !!!\ sprite.CenterSprite(); sprite.Position = pos; sprite.Schedule((dt) => UpdateEnemyState(dt)); }
public Sce.PlayStation.HighLevel.GameEngine2D.SpriteTile Get(int x, int y) { var spriteTile = new SpriteTile(_textureInfo); spriteTile.TileIndex2D = new Vector2i(x,y); spriteTile.Quad.S = new Sce.PlayStation.Core.Vector2(128,96); return spriteTile; }
// CONSTRUCTORS -------------------------------------------------------------------------------------------------------------------------------- public TitleScreen(MenuSystemScene pMenuSystem) { MenuSystem = pMenuSystem; FontMap map = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ); TitleImage = Support.SpriteFromFile("/Application/assets/images/UI/header.png"); TouchToStartText = new Label("touch to start", map); TouchToStartText.Position = new Vector2(229.0f, 73.0f); TouchToStartText.Color = LevelManager.Instance.Palette[0]; TouchToStartText.Color.A = 0.0f; Scheduler.Instance.Schedule( TouchToStartText, (dt) => { TouchToStartText.Color.A += 0.25f * dt; if (TouchToStartText.Color.A >= 1.0f) { TouchToStartText.Color.A = 1.0f; TouchToStartText.UnscheduleAll(); } }, 0, false, 0); this.AddChild(TitleImage); this.AddChild(TouchToStartText); #if DEBUG Console.WriteLine(GetType().ToString() + " created" ); #endif }
// CONSTRUCTOR ----------------------------------------------------------------------- public Slider(int trackLength=320) { active = false; Title = new Label() { FontMap = FontManager.Instance.GetMap( FontManager.Instance.GetInGame("Bariol", 32, "Bold") ), Position = new Vector2(-TICK_WIDTH/2.0f, 29.0f), Color = Colors.Black }; this.AddChild(Title); min = 0.0f; max = 100.0f; val = min; Track = Support.UnicolorSprite("white", 255, 255, 255, 255); Track.Scale = new Vector2((float)trackLength/16.0f, 0.625f); this.AddChild(Track); length = (float)trackLength; // Knob = Support.UnicolorSprite("white", 255, 255, 255, 255); // Knob = Support.SpriteFromFile("/Application/assets/images/UI/sliderLozenge.png"); Knob = Support.SpriteFromAtlas("crystallonUI", "sliderLozenge.png"); Knob.CenterSprite(new Vector2(0.5f, 0.36f)); // Knob.Position = new Vector2((pValue/(max-min+min))*length, 0.0f); this.AddChild(Knob,100); bounds = new Bounds2( new Vector2(-20.0f, -20.0f), new Vector2(length+20.0f, 36.0f) ); #if DEBUG Console.WriteLine(GetType().ToString() + " created" ); #endif }
private SpriteTile spritePlayer = null; //最初に表示されるpngイラスト #endregion Fields #region Constructors /** *@param float positionX 描画する位置(画面の分割率) *@param float positionY 描画する位置(画面の分割率) *@param Scene scene 描画するscene *ファイル名等は今クラス内に埋め込み。読み込むSpriteSheetごとにCallクラスが一つ必要 */ public DrawPlayerSheetSample(float positionX,float positionY,float sizeX,float sizeY, string img, string xml, Scene scene) { playerSheet = new PlayerSheetSample(img,xml);//このSpriteSheetを呼ぶ spritePlayer = playerSheet.Get("Walk_left00"); //最初に表示されるpngイラスト //positionX = Director.Instance.GL.Context.GetViewport().Width/positionX; //positionY = Director.Instance.GL.Context.GetViewport().Height/positionY; positionX = Const.DISPLAY_WIDTH - Const.DISPLAY_WIDTH*(Const.GRID_NUM_X-positionX)/Const.GRID_NUM_X; positionY = Const.DISPLAY_HEIGHT - Const.DISPLAY_HEIGHT*positionY/Const.GRID_NUM_Y; spriteOffset = 0; spriteName = "Walk_left" + spriteOffset.ToString("00"); //var //scene.Camera.SetViewFromViewport(); //var spriteWalker = walker.Get("Walk_left00"); //spriteWalker.Position = scene.Camera.CalcBounds().Center; //spriteWalker.Position = new Vector2(positionX,positionY); //オブジェクトの位置 spritePlayer.CenterSprite(); spritePlayer.Scale = new Vector2(sizeX,sizeY); //サイズの変更 //spriteWalker.Position = new Vector2(positionX+spriteWalker.Quad.S.X/2,positionY-spriteWalker.Quad.S.Y/2); spritePlayer.Position = new Vector2(0,0); spritePlayer.Quad.T.X = positionX; spritePlayer.Quad.T.Y = positionY - spritePlayer.Quad.S.Y; //sceneに追加 scene.AddChild(spritePlayer); }
/// <summary> /// Terminate of Scene. /// </summary> public override void Terminate() { this.scene.RemoveAllChildren(true);//必要 terminateの最初に scene = null; drawPlayerSheet = null; spritePlayerSheet = null; }
public SpriteTile Get(int x, int y) { var spriteTile = new SpriteTile(_textureInfo); spriteTile.TileIndex2D = new Vector2i(x, y); trace (spriteTile.TileIndex2D.ToString()); spriteTile.Quad.S = new Sce.PlayStation.Core.Vector2(160, 160); return spriteTile; }
// OVERRIDES --------------------------------------------------------------------------- public override void OnExit() { base.OnExit (); image = null; cubes = null; score = null; }
public AnimationFall() { b = AnimationFallSpriteSingleton.getInstance().Get("1"); b.Position = new Vector2(100,100); b.CenterSprite(); this.AddChild(b); Scheduler.Instance.ScheduleUpdateForTarget(this, 0,false); }
public CardCostume() { instance = SpriteSingleton.getInstance(); setFace(); spriteTile = instance.Get (spriteName); spriteTile.Position = new Vector2(100.0f, 100.0f); this.AddChild(spriteTile); setColor(); }
public static void Main (string[] args) { Director.Initialize(); Director.Instance.GL.Context.SetClearColor( Colors.Grey20 ); //Director.Instance.DebugFlags |= DebugFlags.Navigate; Vector2 position = new Vector2(300,300); Vector2i sprIndex1 = new Vector2i(0,0); int step = 0; var scene = new Scene(); var texture_info = new TextureInfo( new Texture2D("/Application/Dude1.png", false ), new Vector2i(2,1)); var sprite = new SpriteTile(texture_info, sprIndex1); scene.Camera.SetViewFromViewport(); sprite.Quad.S = texture_info.TextureSizef; scene.AddChild( sprite ); var sprite2 = new SpriteUV() { TextureInfo = texture_info}; sprite2.Quad.S = texture_info.TextureSizef; scene.AddChild( sprite2 ); //sprite2.Position = scene.Camera.CalcBounds().Center; sprite2.Position = position; Director.Instance.RunWithScene( scene ); Initialize (); sprite.TileIndex2D = new Vector2i(1,0); while (true) { GamePadData presses = GamePad.GetData(0); //step++; //if (step == 20) if ((presses.Buttons & GamePadButtons.Down) != 0){ sprite.TileIndex2D.X = 0; position.X++; } //sprIndex1.X = 0; //if (step > 40){ // step = 0; else sprite.TileIndex2D.X = 1; //sprIndex1.X = 1; //} //sprite.TileIndex2D = sprIndex1; SystemEvents.CheckEvents (); Update (); Render (); } }
public void GenerateMap() { for(int i = 0; i < 50; i++) { _sprite = new SpriteTile(_ground.TextureInfo); _ground.AddChild(_sprite); _sprite.TileIndex1D = _random.Next(0,4); _sprite.Quad.S = _sprite.TextureInfo.TextureSizef; _sprite.Position = new Vector2(SceneCamera.CalcBounds().Point00.X + i * _sprite.TextureInfo.TextureSizef.X, SceneCamera.CalcBounds().Point00.Y); } }
// CONSTRUCTORS -------------------------------------------------------------------------------------------------------------------------------------------------- /// <summary> /// Initializes a new instance of the <see cref="Crystallography.CardCrystallonEntity"/> class. /// </summary> /// <param name='pScene'> /// The Parent Scene. /// </param> /// <param name='pGamePhysics'> /// Instance of <c>GamePhysics</c> /// </param> /// <param name='pTextureInfo'> /// <see cref="Sce.PlayStation.HighLevel.GameEngine2D.Base.TextureInfo"/> /// </param> /// <param name='pTileIndex2D'> /// <see cref="Sce.PlayStation.HighLevel.GameEngine2D.Base.Vector2i"/> /// </param> /// <param name='pShape'> /// <see cref="Sce.PlayStation.HighLevel.Physics2D.PhysicsShape"/> /// </param> public CardCrystallonEntity(Scene pScene, GamePhysics pGamePhysics, int pId, PhysicsShape pShape) : base(pScene, pGamePhysics, pShape) { id = pId; _anim = null; GlowSprite = null; Scored = false; // _sprite.Scale*=CARD_SCALAR; _sprite.Position = new Vector2(-Width/2, -Height/2); _keepOnScreenTimer = -1.0f; setVelocity(DEFAULT_SPEED, GameScene.Random.NextAngle()); }
// OVERRIDES ----------------------------------------------------------------------------------------------------------------------- public override void OnExit() { base.OnExit (); this.RemoveAllChildren(true); BenIcon = null; MegIcon = null; NixIcon = null; BenText = null; MegText = null; NixText = null; Map = null; }
protected override void Initialize(bool pStartPaused) { TimeBar2 = Support.UnicolorSprite( "white", 255, 255, 255, 255); base.Initialize (pStartPaused); TimeBar2.Position = TimeBar.Position; TimeBar.RegisterPalette(2); TimeBar2.RegisterPalette(1); TimerIcon.AddChild(TimeBar2); _activeTimeBar.Parent.Children.Reverse(); }
public void testAnimation() { a = Support.TiledSpriteFromFile( "Application/assets/animation/leftGlitch/leftOneLine.png", 15, 1 ); // a = AnimationGlitchSpriteSingleton.getInstance().Get("1"); a.Position = new Vector2(100,100); a.CenterSprite(); this.AddChild(a); a.RunAction( new Support.AnimationAction(a,0,4,3.0f,true) ); Scheduler.Instance.ScheduleUpdateForTarget(this, 0,false); }
public PlayerCreature() { Animations = new Dictionary<string, Animation>(); texInfo = new TextureInfo(AssetManager.GetTexture("spritesheet"), new Vector2i(2,2), TRS.Quad0_1); Animations.Add("idle" , new Animation(0, 2, 0.4f, false)); CurrentAnimation = Animations["idle"]; CurrentAnimation.Play(); sprite = new SpriteTile(texInfo); sprite.TileIndex1D = CurrentAnimation.CurrentFrame; sprite.Quad.S = texInfo.TextureSizef; isJumping = false; }
// EVENT HANDLERS ----------------------------------------------------------------------- // OVERRIDES ---------------------------------------------------------------------------- public override void OnExit() { Background = null; for( int i=0; i<Icons.Length; i++) { Icons[i] = null; } Icons = null; LevelNumberText = null; // Label TapToDismiss = null; map = null; QualityNames.Clear(); base.OnExit (); RemoveAllChildren(true); }
public Car(float xPos, float yPos) : base() { this.speed = 0; this.acceleration = 0; this.animationLocation = 0; spriteSheetHandler = new SpriteSheetHandler(carSpriteSheetPath,carSpriteSheetXMLPath,5,1,175,56); sprite = spriteSheetHandler.Get(animationLocation,0); float pivotCenter = 0.5f; sprite.Pivot = new Vector2(pivotCenter,pivotCenter); sprite.Position = new Vector2(xPos,yPos); this.AddChild(sprite); timer = new System.Diagnostics.Stopwatch(); timer.Start(); }
public HighScoreEntry() { var map = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 102, "Bold") ); _bestCubes = _bestPoints = 0; _bestCubesTitle = new Label() { FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Text = "the most cubes", Position = new Vector2(0.0f, 279.0f) }; _bestCubesTitle.RegisterPalette(0); this.AddChild(_bestCubesTitle); _cubeIcon = Support.SpriteFromFile("/Application/assets/images/UI/cubes_big.png"); _cubeIcon.Position = new Vector2(0.0f, 194.0f); _cubeIcon.RegisterPalette(0); this.AddChild(_cubeIcon); _bestCubesText = new Label() { Text = _bestCubes.ToString(), FontMap = map, Position = new Vector2(97.0f, 174.0f) }; _bestCubesText.RegisterPalette(0); this.AddChild(_bestCubesText); _bestPointsTitle = new Label() { FontMap = Crystallography.UI.FontManager.Instance.GetMap( Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 25, "Bold") ), Text = "the most points", Position = new Vector2(0.0f, 108.0f) }; _bestPointsTitle.RegisterPalette(1); this.AddChild(_bestPointsTitle); _scoreIcon = Support.SpriteFromFile("/Application/assets/images/UI/points_big.png"); _scoreIcon.Position = new Vector2(0.0f, 20.0f); _scoreIcon.RegisterPalette(1); this.AddChild(_scoreIcon); _bestPointsText = new Label() { Text = _bestPoints.ToString(), FontMap = map, Position = new Vector2(97.0f, 0.0f) }; _bestPointsText.RegisterPalette(1); this.AddChild(_bestPointsText); }
public PlayerCreature() { Dead = false; Animations = new Dictionary<string, Animation>(); texInfo = new TextureInfo(AssetManager.GetTexture("catanimation"), new Vector2i(5,1),TRS.Quad0_1); Animations.Add("idle" , new Animation(0, 3, 0.1f, false)); CurrentAnimation = Animations["idle"]; CurrentAnimation.Play(); sprite = new SpriteTile(texInfo); sprite.TileIndex1D = CurrentAnimation.CurrentFrame; sprite.Quad.S = new Vector2(258, 214); sprite.CenterSprite(); isJumping = false; BoundingBox = new Bounds2(new Vector2(0, 258), new Vector2(0, 214)); }
public override void OnExit() { ResumeButton.ButtonUpAction -= HandleResumeButtonButtonUpAction; GiveUpButton.ButtonUpAction -= HandleGiveUpButtonButtonUpAction; InputManager.Instance.StartJustUpDetected -= HandleInputManagerInstanceStartJustUpDetected; base.OnExit (); Background = null; PauseText = null; ResetButton = null; ResumeButton = null; GiveUpButton = null; RemoveAllChildren(true); InputManager.Instance.StartJustUpDetected -= HandleInputManagerInstanceStartJustUpDetected; }
public virtual SpriteTile createSprite(TextureInfo texture_info, float world_scale=1.5f) { SpriteTile sprite; //スプライト生成 sprite = new SpriteTile(){TextureInfo = texture_info}; //表示するテクスチャID sprite.TileIndex1D=0; //拡大率 sprite.Quad.S = sprite.CalcSizeInPixels() * world_scale; //スプライトの中心と座標の中心を一致させる sprite.CenterSprite(); //輝度設定 sprite.Color=new Vector4(1.0f,1.0f,1.0f,1.00f); //表示の混合設定 sprite.BlendMode = BlendMode.Normal; return sprite; }
// CONSTRUCTORS---------------------------------------------------------------------------- public SpriteTileCrystallonEntity( Scene pScene, GamePhysics pGamePhysics, PhysicsShape pShape = null) : base(pScene, pGamePhysics, pShape) { // SPRITE STUFF _orientationIndex = 0; _patternIndex = 0; // _sprite = new SpriteTile(pTextureInfo); _sprite = new SpriteTile(); // _sprite.Scale = _sprite.CalcSizeInPixels(); _node.AddChild(_sprite); // PHYSICS STUFF // if (pShape != null) { // _body = _physics.RegisterPhysicsBody(pShape, 0.1f, 0.01f, _sprite.Position); // } else { // _body = null; // } // Scheduler.Instance.Schedule(_sprite, Update, 0.0f, false); }
/// <summary> /// Initialize of Scene. /// </summary> public override Scene Initialize() { scene.Camera.SetViewFromViewport(); description = WriteString.DrawSprite("左右キー:移動/" + "x:画面から消す/Start:戻る", 0.5f*Const.FIX, 0.5f*Const.FIX, 20, new ImageColor(255,255,255,255), scene); //SpriteSheet画像描画クラス this.drawPlayerSheet = new DrawPlayerSheetSample(10*Const.FIX,9*Const.FIX, 1,1, "walk.png","walk.xml",this.scene); this.spritePlayerSheet = this.drawPlayerSheet.DrawPlayer("init"); return scene; }
public WinSection(Vector2 pos) : base(pos) { sprite = Support.TiledSpriteFromFile("/Application/assets/Goal_Object.png", 1, 1); spriteoverlay = Support.TiledSpriteFromFile("/Application/assets/Goal_Object_Overlay_1.png", 1, 1); sprite.Position = pos; spriteoverlay.Position = pos; sprite.CenterSprite(); spriteoverlay.CenterSprite(); GameScene.Instance.AddChild(sprite); var goaloverlay = Support.TiledSpriteFromFile("/Application/assets/Screen_Object.png", 10, 4); goaloverlay.CenterSprite(); goaloverlay.Position = new Vector2(sprite.Position.X, sprite.Position.Y+35); goaloverlay.VertexZ = 1; this.AddChild(goaloverlay); var ScreenAnimation = new Support.AnimationAction(goaloverlay, 1, 40, 1.0f, looping: true); goaloverlay.RunAction(ScreenAnimation); }
// CONSTRUCTOR --------------------------------------------------------------------------------------------------------------------- public CreditsPanel() { Map = UI.FontManager.Instance.GetMap(Crystallography.UI.FontManager.Instance.GetInGame("Bariol", 36, "Regular") ); BenIcon = Support.SpriteFromFile("/Application/assets/images/UI/icons/tie.png"); BenIcon.Position = new Vector2(302.0f, 184.0f); this.AddChild( BenIcon ); BenText = new Label(){ Text = "ben johnson", Position = new Vector2(113.0f, 186.0f), Color = Colors.White, FontMap = Map }; this.AddChild( BenText ); MegIcon = Support.SpriteFromFile("/Application/assets/images/UI/icons/phones.png"); MegIcon.Position = new Vector2(536.0f, 96.0f); this.AddChild( MegIcon ); MegText = new Label(){ Text = "margaret schedel", Position = new Vector2(272.0f, 100.0f), Color = Colors.White, FontMap = Map }; this.AddChild( MegText ); NixIcon = Support.SpriteFromFile("/Application/assets/images/UI/icons/glasses.png"); NixIcon.Position = new Vector2(595.0f, 184.0f); this.AddChild( NixIcon ); NixText = new Label(){ Text = "phoenix perry", Position = new Vector2(385.0f, 186.0f), Color = Colors.White, FontMap = Map }; this.AddChild( NixText ); }
public EndScene() { _waitTimer = new Timer(); ScheduleUpdate(); _sceneCamera = (Camera2D)Camera; Vector2 ideal_screen_size = new Vector2(960.0f, 544.0f); _sceneCamera.SetViewFromHeightAndCenter(ideal_screen_size.Y, ideal_screen_size / 2.0f); _groundLayer = new Layer(_sceneCamera); Animations = new Dictionary<string, Animation>(); var texInfo = new TextureInfo(AssetManager.GetTexture("catanimation"), new Vector2i(5,1),TRS.Quad0_1); _currentAnimation = new Animation(0, 5, 0.1f, false); _currentAnimation.Play(); _cat = new SpriteTile(texInfo); _cat.TileIndex1D = _currentAnimation.CurrentFrame; _cat.Quad.S = new Vector2(258, 214); _cat.CenterSprite(); _cat.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X, _sceneCamera.CalcBounds().Point00.Y + _cat.TextureInfo.TextureSizef.Y/2 +64 ); var background = new SpriteTile(new TextureInfo(AssetManager.GetTexture("background_paper"))); background.Quad.S = background.TextureInfo.TextureSizef; background.CenterSprite(); background.Position = _sceneCamera.CalcBounds().Center; for(var i = 0; i < 5; i++) { var _sprite = new GroundTile(new TextureInfo(AssetManager.GetTexture("ground_tile"))); _groundLayer.AddChild(_sprite); _sprite.Quad.S = _sprite.TextureInfo.TextureSizef; _sprite.Position = new Vector2(_sceneCamera.CalcBounds().Point00.X + i * _sprite.TextureInfo.TextureSizef.X, _sceneCamera.CalcBounds().Point00.Y - _sprite.TextureInfo.TextureSizef.Y / 2); } _musicPlayer = AssetManager.GetBGM("endscreen").CreatePlayer(); _musicPlayer.Play(); AddChild(background); AddChild (_cat); AddChild (_groundLayer); }
public static Sce.PlayStation.HighLevel.GameEngine2D.SpriteTile TiledSpriteFromFile(string filename, int x, int y) { if (TextureCache.ContainsKey(filename) == false) { TextureCache[filename] = new Texture2D(filename, false); TextureInfoCache[filename] = new TextureInfo(TextureCache[filename], new Vector2i(x, y)); } var tex = TextureCache[filename]; var info = TextureInfoCache[filename]; var result = new Sce.PlayStation.HighLevel.GameEngine2D.SpriteTile() { TextureInfo = info }; result.TileIndex2D = new Vector2i(0, 0); result.Quad.S = new Vector2(info.Texture.Width / x, info.Texture.Height / y); tex.SetFilter(DefaultTextureFilterMode); return(result); }