public LoadingDisplay() { tbox = new GameTextBox("m41_lovebit"); tbox.Text = "Loading ..."; tbox.Motion.Position = new Microsoft.Xna.Framework.Vector2(LEFT_POSITION, 0.05f); // TODO consts Add(tbox); iggNameBox = new GameTextBox("GameDescriptionFont"); iggNameBox.Text = "Glorious Wreckz Garden Exit current game or hold ESC to return to the garden"; iggNameBox.Motion.Position = new Microsoft.Xna.Framework.Vector2(LEFT_POSITION, 0.94f); iggNameBox.Motion.Scale = 0.75f; iggNameBox.DrawInfo.DrawColor = new Color(245, 245, 245, 0); iggNameBox.ColorB.Alpha = 0f; iggNameBox.ColorB.AlphaTarget = 0.0f; iggNameBox.ColorB.FadeSpeed = 1.0f; Add(iggNameBox); helpTextBox = new GameTextBox("GameDescriptionFont"); helpTextBox.Text = ""; helpTextBox.Motion.Position = new Microsoft.Xna.Framework.Vector2(LEFT_POSITION, 0.83f); helpTextBox.Motion.Scale = 1.0f; Add(helpTextBox); gameIcon = new Spritelet(); //gameIcon.Motion.Position = new Vector2( Screen.Width*0.8f , 0.2f); gameIcon.Motion.Position = Screen.Center; gameIcon.DrawInfo.LayerDepth = 1f; gameIcon.DrawInfo.DrawColor = Color.Gray; Add(gameIcon); // setup initial state SetNextState(new StateLoadingDisplay_Loading(this)); }
public LoadingDisplay() { tbox = new GameTextBox("m41_lovebit"); tbox.Text = "Loading ..."; tbox.Motion.Position = new Microsoft.Xna.Framework.Vector2(LEFT_POSITION, 0.05f); // TODO consts Add(tbox); iggNameBox = new GameTextBox("GameDescriptionFont"); iggNameBox.Text = "Indiegame Garden Exit this game to return to the garden"; iggNameBox.Motion.Position = new Microsoft.Xna.Framework.Vector2(LEFT_POSITION, 0.94f); iggNameBox.Motion.Scale = 0.7f; iggNameBox.DrawInfo.DrawColor = Color.Transparent; iggNameBox.ColorB.Intensity = 0f; iggNameBox.ColorB.FadeTarget = 0.0f; iggNameBox.ColorB.FadeSpeed = 1.0f; Add(iggNameBox); helpTextBox = new GameTextBox("GameDescriptionFont"); helpTextBox.Text = ""; helpTextBox.Motion.Position = new Microsoft.Xna.Framework.Vector2(LEFT_POSITION, 0.83f); helpTextBox.Motion.Scale = 1.0f; Add(helpTextBox); gameIcon = new Spritelet(); //gameIcon.Motion.Position = new Vector2( Screen.Width*0.8f , 0.2f); gameIcon.Motion.Position = Screen.Center; gameIcon.DrawInfo.LayerDepth = 1f; gameIcon.DrawInfo.DrawColor = Color.Gray; Add(gameIcon); // setup initial state SetNextState(new StateLoadingDisplay_Loading(this)); }
public PixieLogo(string logoGraphics) : base(logoGraphics) { bg = new Spritelet("psych"); bg.DrawInfo.DrawColor = Color.White * bgColMultiplier; bg.Motion.Scale = 2.0f; //Add(bg); bg.Visible = false; // do draw ourselves spriteBatch = new SpriteBatch(Screen.graphicsDevice); }
public TitleScreen() { bg = new RotatingBackground("psych"); bg.Motion.Scale = 20.0f; bg.StartTime = 0f;// 9.09f; Add(bg); pixie = new Pixie(); pixie.Motion.Position = new Vector2(0.666f, 0.0f); pixie.Motion.Scale = 20.0f; pixie.Duration = TIME_LOGO_APPEAR; Add(pixie); cuteText = new SubtitleText(new string[] { "She's pink...", " She's cute...", " She's all square!" }, new float[] { 1.5f, 3.5f, 5.5f }, false); cuteText.Motion.Position = new Vector2(0.26f, 0.62f); cuteText.Duration = TIME_LOGO_APPEAR; Add(cuteText); /* * helpText = new SubtitleText("SPACE Play!\n C Credits\n ESC Exit"); * helpText.StartTime = 13.5f; * helpText.Motion.Scale = 0.7f; * helpText.DrawInfo.DrawColor = Color.AntiqueWhite; * helpText.Motion.Position = new Vector2(0.2f, 0.6f); * Add(helpText); */ helpText = new Spritelet("showControls"); helpText.StartTime = TIME_LOGO_APPEAR; helpText.Motion.Scale = 1f; helpText.Motion.Position = new Vector2(0.666f, 0.85f); Add(helpText); pixieLogo = new PixieLogo("pixielogo"); pixieLogo.Motion.Scale = 20.0f; pixieLogo.Motion.Position = new Vector2(0.666f, 0.35f); pixieLogo.StartTime = TIME_LOGO_APPEAR; Add(pixieLogo); MotionB = new MotionBehavior(); Add(MotionB); creditsScreen = new Thing("credits.png"); Add(creditsScreen); creditsScreen.Visible = false; /* * ttLogo = new Spritelet("tt-logo-4"); * ttLogo.Motion.Position = new Vector2(1.05f, 0.02f); * Add(ttLogo); */ }
public override void OnCollision(Spritelet gi) { base.OnCollision(gi); if (gi is Ship) { Ball b = Parent as Ball; Position = b.Position; // new Vector2(0.5f, 0.5f); // b.Position; hasFired = true; Visible = true; } }
void GardenInit() { // loading screen loadingScreenlet = new Screenlet(myWindowWidth, myWindowHeight); TTengineMaster.ActiveScreen = loadingScreenlet; loadingScreenlet.ActiveInState = new StatePlayingGame(); loadingScreenlet.DrawInfo.DrawColor = Color.Black; loadingDisplay = new LoadingDisplay(); loadingScreenlet.Add(loadingDisplay); // from here on, main screen mainScreenlet = new Screenlet(myWindowWidth, myWindowHeight); TTengineMaster.ActiveScreen = mainScreenlet; //mainScreenlet.ActiveInState = new StateBrowsingMenu(); TreeRoot = new FixedTimestepPhysics(); TreeRoot.SetNextState(new StateStartup()); // set the initial state TreeRoot.Add(mainScreenlet); TreeRoot.Add(loadingScreenlet); mainScreenlet.DrawInfo.DrawColor = new Color(169 * 2 / 3, 157 * 2 / 3, 241 * 2 / 3); // Color.Black; // graphics bitmap scaling that adapts to screen resolution mainScreenlet.Motion.Scale = ((float)myWindowHeight) / 900f; loadingScreenlet.Motion.Scale = mainScreenlet.Motion.Scale; // Spritelet SplashScreen = new Spritelet("igglogo"); SplashScreen.DrawInfo.LayerDepth = 1f; SplashScreen.ActiveInState = new StateStartup(); //l.Duration = 17.5f; SplashScreen.Motion.Position = mainScreenlet.Center; //l.Motion.Add(new MyFuncyModifier( delegate(float v) { return 1f-(float)Math.Sqrt((18f-v)/18f); }, "Scale" )); mainScreenlet.Add(SplashScreen); // music engine musicEngine = MusicEngine.GetInstance(); musicEngine.AudioPath = "."; if (!musicEngine.Initialize()) { throw new Exception(musicEngine.StatusMsg); } Thread t = new Thread(new ThreadStart(GardenInitInBackground)); t.Start(); }
/// <summary> /// construct new menu /// </summary> public GameChooserMenu() { ActiveInState = new StateBrowsingMenu(); panel = new GardenGamesPanel(this); panel.Motion.Position = new Vector2(0.0f, 0.0f); // get the items to display gamesList = GardenGame.Instance.GameLib.GetList(); // background Spritelet bg = new Spritelet("wee2"); bg.Motion.Position = new Vector2(0.68f, 0.425f); bg.DrawInfo.LayerDepth = 1f; //bg.DrawInfo.DrawColor = new Color(0.3f, 0.3f, 0.3f, 0.3f); // bg color 169, 157, 241 bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(v / 44.7f); }, "Rotate")); bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(10.5f + 0.95f * (float)Math.Sqrt(v / 430.0)); }, "Scale")); bg.Motion.TargetPos = new Vector2(Screen.Width / 2.0f + 0.1f, 0.75f); bg.Motion.TargetPosSpeed = 0.004f; Add(bg); background = bg; // logo that floats in top right Spritelet logo = new Spritelet("gtlogo"); Add(logo); logo.DrawInfo.Alpha = 0.0f; logo.Motion.Scale = 0.7f; logo.Motion.Position = new Vector2(Screen.AspectRatio - 0.24f, 0.06f); //ColorChangeBehavior fadeIn = new ColorChangeBehavior(); //logo.Add(fadeIn); //fadeIn.Alpha = 0f; //fadeIn.AlphaTarget = 0f; //fadeIn.FadeAlphaToTarget(0.9344f, 6f); logo.Motion.Add(new SineModifier("ScaleModifier", 0.06124f, 0.07144f, 1.0f)); // set my panel and games list Add(panel); panel.OnUpdateList(gamesList); }
/// <summary> /// construct new menu /// </summary> public GameChooserMenu() { ActiveInState = new StateBrowsingMenu(); panel = new GardenGamesPanel(this); panel.Motion.Position = new Vector2(0.0f, 0.0f); // get the items to display gamesList = GardenGame.Instance.GameLib.GetList(); // background Spritelet bg = new Spritelet("parc-by-gadl.png"); bg.Motion.Position = new Vector2(0.66667f, 0.22f); bg.DrawInfo.LayerDepth = 1f; //bg.DrawInfo.DrawColor = new Color(0.3f, 0.3f, 0.3f, 0.3f); // bg color 169, 157, 241 bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(v / 70.0f); }, "Rotate")); bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return(0.45f + 0.75f * (float)Math.Sqrt(v / 430.0)); }, "Scale")); bg.Motion.TargetPos = new Vector2(0.66667f, 0.9f); bg.Motion.TargetPosSpeed = 0.004f; Add(bg); background = bg; // logo Spritelet logo = new Spritelet("igglogo"); Add(logo); logo.DrawInfo.Alpha = 0.7f; logo.Motion.Scale = 0.55f; logo.Motion.Position = new Vector2(Screen.AspectRatio - 0.24f, 0.04f); ColorChangeBehavior fadeIn = new ColorChangeBehavior(); logo.Add(fadeIn); fadeIn.Intensity = 0f; fadeIn.FadeToTarget(0.9344f, 6f); logo.Motion.Add(new SineModifier("ScaleModifier", 0.03124f, 0.07344f, 1.0f)); // set my panel and games list Add(panel); panel.OnUpdateList(gamesList); }
public override bool CollidesWith(Spritelet item) { if (item is Ball) { float itemR = item.RadiusAbsolute * (item as Ball).CollisionScale; Vector2 itemPos = item.PositionAbsolute; Vector2 pos = PositionAbsolute; float ytop = pos.Y - HeightAbsolute / 2; float ybot = pos.Y + HeightAbsolute / 2; float r = 1.0f * RadiusAbsolute ; // radius of tips of the ship with minor corr factor // step 1) first weed out the clear 'not collide' cases (see log 3/3/11) if (itemPos.Y + itemR < ytop) // if above ship return false; if (itemPos.Y - itemR > ybot) // if below ship return false; if (itemPos.X - itemR > (pos.X + r)) // if right-of ship return false; if (itemPos.X + itemR < (pos.X - r)) // if already left-of ship return false; // step 1b) case where ball is too leftish of ship if (itemPos.X < (pos.X - r)) // if already left-of ship return false; // step 2) check if 'in' pTop/pBot defined points Vector2 pTop = new Vector2(pos.X, ytop + r); Vector2 pBot = new Vector2(pos.X, ybot - r); if ((pTop - itemPos).Length() <= (itemR + r)) return true; if ((pBot - itemPos).Length() <= (itemR + r)) return true; // step 3) check if in body if (itemPos.Y > ytop && itemPos.Y < ybot) return true; } // all other cases, default return false; }
public GardenGamesPanel(GameChooserMenu parent) { parentMenu = parent; // cursor cursor = new GameThumbnailCursor(); Add(cursor); cursor.Motion.Scale = CURSOR_SCALE_REGULAR; cursor.Motion.Position = CURSOR_INITIAL_POSITION * new Vector2(PANEL_DELTA_GRID_X, PANEL_DELTA_GRID_Y); cursor.Motion.TargetPos = CURSOR_INITIAL_POSITION * new Vector2(PANEL_DELTA_GRID_X, PANEL_DELTA_GRID_Y); cursor.GridPosition = CURSOR_INITIAL_POSITION; cursor.Motion.Add(new MyFuncyModifier(delegate(float v) { return(v / 10.3f); }, "Rotate")); // info box - will be added to parent upon OnNewParent() event infoBox = new GameInfoBox(); infoBox.Motion.Position = INFOBOX_ALL_HIDDEN_POSITION; infoBox.Motion.TargetPos = INFOBOX_SHOWN_POSITION; infoBox.Motion.TargetPosSpeed = INFOBOX_SPEED_MOVE; // controls help helpTextBitmap = new Spritelet("keymap"); helpTextBitmap.Motion.Scale = HELPTEXT_SCALE_DEFAULT; helpTextBitmap.Motion.Position = HELPTEXT_HIDDEN_POSITION; helpTextBitmap.Motion.TargetPos = HELPTEXT_SHOWN_POSITION; helpTextBitmap.Motion.TargetPosSpeed = HELPTEXT_SPEED_MOVE; // credits creditsBitmap = new Spritelet("credits.png"); creditsBitmap.Motion.Scale = CREDITS_SCALE_DEFAULT; creditsBitmap.Motion.Position = CREDITS_HIDDEN_POSITION; creditsBitmap.Motion.TargetPos = CREDITS_HIDDEN_POSITION; creditsBitmap.Motion.TargetPosSpeed = CREDITS_SPEED_MOVE; // default zoom Motion.Zoom = PANEL_ZOOM_DETAILED_VIEW; Motion.ZoomTarget = PANEL_ZOOM_DETAILED_VIEW; Motion.ZoomSpeed = PANEL_ZOOM_SPEED_REGULAR; Motion.ZoomCenterTarget = cursor.Motion; }
public FinalScreen() { finalText = new SubtitleText(TXT, TXT_TIMINGS, false); finalText.SubtitleFont = TTengineMaster.ActiveGame.Content.Load <SpriteFont>("m06_quadra"); finalText.Motion.Position = new Vector2(0.1f, 0.32f); finalText.ScaleVector = new Vector2(1f, 1f); finalText.Shadow = false; Add(finalText); pixieLogo = new PixieLogo("finallogo"); Add(pixieLogo); pixieLogo.Motion.Scale = 1f; //pixieLogo.bg.Motion.Scale = 2f; pixieLogo.Motion.Position = new Vector2(0.666f, 0.1f); pixieLogo.StartTime = 0f; bg = new RotatingBackground("psych"); bg.Motion.Scale = 20.0f; Add(bg); this.Duration = 74f; }
/// <summary> /// construct new menu /// </summary> public GameChooserMenu() { ActiveInState = new StateBrowsingMenu(); panel = new GardenGamesPanel(this); panel.Motion.Position = new Vector2(0.0f, 0.0f); // get the items to display gamesList = GardenGame.Instance.GameLib.GetList(); // background Spritelet bg = new Spritelet("parc-by-gadl.png"); bg.Motion.Position = new Vector2(0.66667f, 0.22f); bg.DrawInfo.LayerDepth = 1f; //bg.DrawInfo.DrawColor = new Color(0.3f, 0.3f, 0.3f, 0.3f); // bg color 169, 157, 241 bg.Motion.Add(new MyFuncyModifier( delegate(float v) { return v/70.0f; }, "Rotate")); bg.Motion.Add(new MyFuncyModifier(delegate(float v) { return (0.45f + 0.75f * (float) Math.Sqrt(v/430.0)); }, "Scale")); bg.Motion.TargetPos = new Vector2(0.66667f, 0.9f); bg.Motion.TargetPosSpeed = 0.004f; Add(bg); background = bg; // logo Spritelet logo = new Spritelet("igglogo"); Add(logo); logo.DrawInfo.Alpha = 0.7f; logo.Motion.Scale = 0.55f; logo.Motion.Position = new Vector2(Screen.AspectRatio - 0.24f, 0.04f); ColorChangeBehavior fadeIn = new ColorChangeBehavior(); logo.Add(fadeIn); fadeIn.Intensity = 0f; fadeIn.FadeToTarget(0.9344f, 6f); logo.Motion.Add(new SineModifier("ScaleModifier", 0.03124f, 0.07344f, 1.0f)); // set my panel and games list Add(panel); panel.OnUpdateList(gamesList); }
void GardenInit() { // loading screen loadingScreenlet = new Screenlet(myWindowWidth, myWindowHeight); TTengineMaster.ActiveScreen = loadingScreenlet; loadingScreenlet.ActiveInState = new StatePlayingGame(); loadingScreenlet.DrawInfo.DrawColor = Color.Black; loadingDisplay = new LoadingDisplay(); loadingScreenlet.Add(loadingDisplay); // from here on, main screen mainScreenlet = new Screenlet(myWindowWidth, myWindowHeight); TTengineMaster.ActiveScreen = mainScreenlet; //mainScreenlet.ActiveInState = new StateBrowsingMenu(); TreeRoot = new FixedTimestepPhysics(); TreeRoot.SetNextState(new StateStartup()); // set the initial state TreeRoot.Add(mainScreenlet); TreeRoot.Add(loadingScreenlet); mainScreenlet.DrawInfo.DrawColor = new Color(169 * 2 / 3, 157 * 2 / 3, 241 * 2 / 3); // Color.Black; // graphics bitmap scaling that adapts to screen resolution mainScreenlet.Motion.Scale = ((float)myWindowHeight) / 900f; loadingScreenlet.Motion.Scale = mainScreenlet.Motion.Scale; // Spritelet SplashScreen = new Spritelet("igglogo"); SplashScreen.DrawInfo.LayerDepth = 1f; SplashScreen.ActiveInState = new StateStartup(); //l.Duration = 17.5f; SplashScreen.Motion.Position = mainScreenlet.Center; //l.Motion.Add(new MyFuncyModifier( delegate(float v) { return 1f-(float)Math.Sqrt((18f-v)/18f); }, "Scale" )); mainScreenlet.Add(SplashScreen); // music engine musicEngine = MusicEngine.GetInstance(); musicEngine.AudioPath = "."; if (!musicEngine.Initialize()) throw new Exception(musicEngine.StatusMsg); Thread t = new Thread(new ThreadStart(GardenInitInBackground)); t.Start(); }
public override void OnCollision(Spritelet item) { base.OnCollision(item); }
public GardenGamesPanel(GameChooserMenu parent) { parentMenu = parent; // cursor cursor = new GameThumbnailCursor(); Add(cursor); cursor.Motion.Scale = CURSOR_SCALE_REGULAR; cursor.Motion.Position = CURSOR_INITIAL_POSITION * new Vector2(PANEL_DELTA_GRID_X, PANEL_DELTA_GRID_Y); cursor.Motion.TargetPos = CURSOR_INITIAL_POSITION * new Vector2(PANEL_DELTA_GRID_X, PANEL_DELTA_GRID_Y); cursor.GridPosition = CURSOR_INITIAL_POSITION; // info box - will be added to parent upon OnNewParent() event infoBox = new GameInfoBox(); infoBox.Motion.Position = INFOBOX_ALL_HIDDEN_POSITION; infoBox.Motion.TargetPos = INFOBOX_SHOWN_POSITION; infoBox.Motion.TargetPosSpeed = INFOBOX_SPEED_MOVE; // controls help helpTextBitmap = new Spritelet("keymap"); helpTextBitmap.Motion.Scale = 0.5f; helpTextBitmap.Motion.Position = HELPTEXT_HIDDEN_POSITION; helpTextBitmap.Motion.TargetPos = HELPTEXT_SHOWN_POSITION; helpTextBitmap.Motion.TargetPosSpeed = HELPTEXT_SPEED_MOVE; // credits creditsBitmap = new Spritelet("credits.png"); creditsBitmap.Motion.Scale = CREDITS_SCALE_DEFAULT; creditsBitmap.Motion.Position = CREDITS_HIDDEN_POSITION; creditsBitmap.Motion.TargetPos = CREDITS_HIDDEN_POSITION; creditsBitmap.Motion.TargetPosSpeed = CREDITS_SPEED_MOVE; // default zoom Motion.Zoom = PANEL_ZOOM_DETAILED_VIEW; Motion.ZoomTarget = PANEL_ZOOM_DETAILED_VIEW; Motion.ZoomSpeed = PANEL_ZOOM_SPEED_REGULAR; Motion.ZoomCenterTarget = cursor.Motion; }
protected void TestRotatingBall() { Spritelet b = new Spritelet("ball-supernova2"); b.Position = new Vector2(0.6f, 0.5f); b.LayerDepth = 0.91f; b.Add(new MyFuncyModifier(delegate(float t) { b.RotateModifier += t / 10f; })); gameletsRoot.Add(b); }
public override void OnCollision(Spritelet withItem) { base.OnCollision(withItem); if (withItem is Ship) NrShipCollides++; }
public override bool CollidesWith(Spritelet item) { if (item is Ship) { return (item as Ship).CollidesWith(this); } if (item is Ball) { if ((PositionAbsolute - item.PositionAbsolute).Length() < CollisionScale * (RadiusAbsolute + item.RadiusAbsolute)) return true; else return false; } return false; }