private void StoreDrawing() { Drawing record = new Drawing(); record.StoreGraphicsNow(); drawings.Add(record); StoreAllDoodles(); SnapsEngine.ClearGraphics(); }
private void StorePicture() { MustachePicture record = new MustachePicture(); record.StoreGraphicsNow(); rogueImages.Add(record); StoreAllRogues(); SnapsEngine.ClearGraphics(); }
void DisplayDrawings() { foreach (Drawing d in drawings) { d.ShowStoredGraphics(); SnapsEngine.Delay(.5); } SnapsEngine.ClearGraphics(); }
public void StartProgram() { string guestName; guestName = SnapsEngine.ReadString("What is your name"); string fullMessage = "The honorable Mister " + guestName; SnapsEngine.SpeakString(fullMessage); }
void DisplayRoguesGallery() { foreach (MustachePicture d in rogueImages) { d.ShowStoredGraphics(); SnapsEngine.Delay(.5); } SnapsEngine.ClearGraphics(); }
/// <summary> /// Asks the user for contact details and then stores them /// </summary> void NewContact() { SnapsEngine.DisplayString("Enter the contact"); string name = SnapsEngine.ReadString("Enter new contact name"); string address = SnapsEngine.ReadMultiLineString("Enter contact address"); string phone = SnapsEngine.ReadString("Enter contact phone"); StoreContact(name: name, address: address, phone: phone); }
void StartSnapsProgram() { if (snapManager == null) { snapManager = SnapsManager.SetupManager(DisplayGrid); SnapsEngine.SetManager(snapManager); } SnapsManager.ActiveSnapsManager.StartProgram(typeof(MyProgram), "StartProgram"); }
/// <summary> /// Stores a contact in local store /// </summary> /// <param name="name">name to use to label the item</param> /// <param name="address">address to store</param> /// <param name="phone">phone to store</param> void StoreContact(string name, string address, string phone) { name = TidyInput(name); SnapsEngine.SaveStringToLocalStorage(itemName: name + ":address", itemValue: address); SnapsEngine.SaveStringToLocalStorage(itemName: name + ":phone", itemValue: phone); }
public void StartProgram() { int temperature = SnapsEngine.GetTodayTemperatureInFahrenheit(latitude: 34.03, longitude: -84.62); string fullMessage; fullMessage = "The current temperature is " + temperature + " degrees."; SnapsEngine.DisplayString(fullMessage); }
public void StartProgram() { int tempInFahrenheit = 54; float tempInCentigrade = (tempInFahrenheit - 32) / 1.8f; SnapsEngine.DisplayString("Fahreneheit: " + tempInFahrenheit); SnapsEngine.Delay(2); SnapsEngine.DisplayString("Centigrade: " + tempInCentigrade); }
void DisplayHelp() { SnapsEngine.SetTitleString("Drawing Diary"); SnapsEngine.DisplayString("Touch the top left hand corner to display the menu"); SnapsEngine.Delay(3); SnapsEngine.SetTitleString(""); SnapsEngine.DisplayString(""); }
public void StartProgram() { SnapsEngine.StartGameEngine(fullScreen: false, framesPerSecond: 60); while (true) { // Game update logic goes here SnapsEngine.DrawGamePage(); } }
public void StartProgram() { int hourValue = SnapsEngine.GetHourValue(); bool ItIsTimeToGetUp = hourValue > 6; if (ItIsTimeToGetUp) { SnapsEngine.DisplayString("Time to get up"); } }
public void TakeDamage() { LivesLeft = LivesLeft - 1; SnapsEngine.PlayGameSoundEffect("ding"); if (LivesLeft == 0) { gameValue.EndCurrentGame(); } }
public void PlayNote(int pitch, double duration) { if (pitch < 0 || pitch >= noteNames.Length) { return; } StartPlayingSoundEffectatLocation(@"Sounds\MusicNotes\" + noteNames[pitch] + ".wav"); SnapsEngine.Delay(duration); }
public void StoreContact(string name, string address, string phone) { name = TidyInput(name); //create a name to store the address SnapsEngine.SaveStringToLocalStorage(itemName: name + ":address", itemValue: address); //create a name to store the phonenumber SnapsEngine.SaveStringToLocalStorage(itemName: name + ":phone", itemValue: phone); }
public void StartProgram() { string name; name = SnapsEngine.ReadString("What is your name"); if (name == "Rob") { SnapsEngine.DisplayString("Hello, Oh great one"); } }
public override void Update() { if (SnapsEngine.GetUpGamepad()) { spriteValue.Y = spriteValue.Y - ySpeedValue; } if (SnapsEngine.GetDownGamepad()) { spriteValue.Y = spriteValue.Y + ySpeedValue; } if (SnapsEngine.GetRightGamepad()) { spriteValue.X = spriteValue.X + xSpeedValue; } if (SnapsEngine.GetLeftGamepad()) { spriteValue.X = spriteValue.X - xSpeedValue; } if (spriteValue.Left < 0) { spriteValue.Left = 0; } if (spriteValue.Right > SnapsEngine.GameViewportWidth) { spriteValue.Right = SnapsEngine.GameViewportWidth; } if (spriteValue.Top < 0) { spriteValue.Top = 0; } if (spriteValue.Bottom > SnapsEngine.GameViewportHeight) { spriteValue.Bottom = SnapsEngine.GameViewportHeight; } if (SnapsEngine.GetFireGamepad()) { // Work through all the missiles foreach (MissileSprite missile in Missiles) { if (!missile.IsFlying) { // if the missile is not flying we can launch it missile.FireMissile(spriteValue.CenterX, spriteValue.CenterY); } } } }
void newContact() { SnapsEngine.SetTitleString("New Contact"); string errorMessage; string name; do { name = SnapsEngine.ReadString("Enter new contact name"); errorMessage = Contact.ValidateName(name); if (errorMessage != "") { SnapsEngine.DisplayString(errorMessage); SnapsEngine.WaitForButton("Try again"); SnapsEngine.DisplayString(""); } } while (errorMessage != ""); string address; do { address = SnapsEngine.ReadMultiLineString("Enter contact address"); errorMessage = Contact.ValidateAddress(address); if (errorMessage != "") { SnapsEngine.DisplayString(errorMessage); SnapsEngine.WaitForButton("Try again"); SnapsEngine.DisplayString(""); } } while (errorMessage != ""); string phone; do { phone = SnapsEngine.ReadString("Enter contact phone"); errorMessage = Contact.ValidatePhone(phone); if (errorMessage != "") { SnapsEngine.DisplayString(errorMessage); SnapsEngine.WaitForButton("Try again"); SnapsEngine.DisplayString(""); } } while (errorMessage != ""); Contact newContact = new Contact(name: name, address: address, phone: phone); storeContact(newContact); storeAllContacts(); SnapsEngine.DisplayString("Contact stored"); }
public void StartProgram() { if (SnapsEngine.ThrowDice() < 4 || SnapsEngine.ThrowDice() > 8) { SnapsEngine.SpeakString("You are going to meet a tall, attractive stranger"); } else { SnapsEngine.SpeakString("You are not going to meet anyone at all"); } }
public void StartProgram() { SnapsEngine.DisplayImageFromUrl("https://st.hzcdn.com/simgs/1711fefa0603fedf_4-1809/industrial-novelty-signs.jpg"); // add background image of a diner sign SnapsEngine.SetTitleString("Car Counter"); // variables that count the number of cars, vans, bikes, and trucks int car = 0; int van = 0; int bike = 0; int truck = 0; bool button = true; // loop that allows user to keep clicking on different transportations until user wants sum. while (button == true) { // stores what user selects from the 5 buttons string pick = SnapsEngine.SelectFrom5Buttons("Car", "Van", "Bike", "Truck", "Sum"); // adds one to whichever user picks if (pick == "Car") { car = car + 1; } if (pick == "Van") { van = van + 1; } if (pick == "Bike") { bike = bike + 1; } if (pick == "Truck") { truck = truck + 1; } if (pick == "Sum") { // if user picks sum text is cleared and then program gives user the amount of times he/she clicked on each transportation. SnapsEngine.ClearTextDisplay(); SnapsEngine.AddLineToTextDisplay("There were " + car.ToString() + " cars"); SnapsEngine.Delay(10); SnapsEngine.AddLineToTextDisplay("There were " + van.ToString() + " vans"); SnapsEngine.Delay(10); SnapsEngine.AddLineToTextDisplay("There were " + bike.ToString() + " bikes"); SnapsEngine.Delay(10); SnapsEngine.AddLineToTextDisplay("There were " + truck.ToString() + " trucks"); SnapsEngine.Delay(10); // ends the ability to select transportations. button = false; } { } } }
public void StartProgram() { SnapsEngine.SetTitleString("Age between 1 and 100"); int age; do { age = SnapsEngine.ReadInteger("Enter your age"); } while (age < 1 & age > 100); SnapsEngine.DisplayString("Thank you for entering your age of " + age); }
public void StartProgram() { SnapsCoordinate origin = new SnapsCoordinate(x: 0, y: 0); SnapsEngine.SetDrawingColor(red: 255, green: 0, blue: 0); while (true) { SnapsCoordinate lineEnd = SnapsEngine.GetTappedCoordinate(); SnapsEngine.DrawLine(p1: origin, p2: lineEnd); } }
public void StartProgram() { if (SnapsEngine.GetDayOfWeekName() == "Saturday" & SnapsEngine.GetHourValue() > 8) { SnapsEngine.DisplayString("It is time to get up"); } else { SnapsEngine.DisplayString("When is this message printed?"); } }
public static void StartProgram() { string rssText = SnapsEngine.GetWebPageAsString("http://www.robmiles.com/?format=rss"); XElement rssElements = XElement.Parse(rssText); string title = rssElements.Element("channel").Element("item").Element("title").Value; SnapsEngine.SetTitleString("Headline from Rob"); SnapsEngine.DisplayString(title); }
public void StartProgram() { int noOfStands = SnapsEngine.ReadInteger("How many ice cream stands"); int[] sales = new int[noOfStands]; for (int count = 0; count < sales.Length; count = count + 1) { sales[count] = SnapsEngine.ReadInteger("Enter the sales for stand " + count + 1); } }
int Limit(string prompt, int min, int max) { int result; do { result = SnapsEngine.ReadInteger(prompt); } while (result < min || result > max); return(result); }
public void StartProgram() { int age; do { age = SnapsEngine.ReadInteger("Enter your age"); } while (age < 1 | age > 100); SnapsEngine.DisplayString("Your age is " + age); }
public void StartProgram() { if (SnapsEngine.GetHourValue() < 9) { SnapsEngine.DisplayString("Go back to sleep"); } else { SnapsEngine.DisplayString("Time to get up"); } }
public void StartProgram() { SongNote [] notes = new SongNote[3]; notes[0].NotePitch = 0; notes[0].NoteDuration = 0.4; notes[1].NotePitch = 2; notes[1].NoteDuration = 0.8; notes[2].NotePitch = 4; notes[2].NoteDuration = 0.4; for (int i = 0; i < 3; i = i + 1) { SnapsEngine.PlayNote(pitch: notes[i].NotePitch, duration: notes[i].NoteDuration); } }