12 game cues of Silverlight puzzle games (1)

Source: Internet
Author: User

In the previous article, we changed the shape of the mouse pointer to make the game look better. In this article, we will add a hint (hint) function for the game. When the player cannot find the item, give some help (believeArticleWe should be able to find 13 items with closed eyes). We will still use a variety of animation and custom behavior functions in this article.

This article will be completed in the following three parts:

1. Create a suggestion button
2. Hint through halo Animation
3. Random suggestion on items

 

1First, we need to display the progress bar on the computer when you click the hint image, and the word "hint" disappears:

1.1(Laptop.png) Add to the images folder. Create a new canvas named:Hintcanvas, Add laptop.png to it; createHinttextblockThe text is "hint", and a progressbar is also required:Progressbar:

 Pay attention to their location relationship in the Treeview

Set progressbar opacity to 0 and foreground to Green:

1.2To achieve the above effect, we addHintstatesGroup, and addHintstateAndRechargestate:

Recording hintstate, select hinttextblock, and set ishittestvisibleTrue:

Rechargestate recording, set the opacity of hinttextblock0%, Ishittestvisible is setFalse, Set the opacity of progressbar100%:

 

1.3. Click hinttextblock and the rechargestate will be run. In the hinttextblock, createGotostateactionAnd perform the following settings:

 

1.4To display the progress bar, add a storyboard in mainpage. XAML:Rechargingstoryboard, Set its running time20Seconds:

 <  Storyboard  X  :  Name  = "Rechargingstoryboard"> <  Doubleanimationusingkeyframes  Begintime  = "00:00:00"
Storyboard. targetname = "Progressbar"
Storyboard. targetproperty = "(Rangebase. Value)"> < Easingdoublekeyframe Keytime = "00:00:00" Value = "0"/> < Easingdoublekeyframe Keytime = "00:00:30" Value = "100"/> </ Doubleanimationusingkeyframes > </ Storyboard >

 

When you click hinttextblock, the storyboard will be run and added to the hinttextblock.Controlstoryboardaction, SelectRechargingstoryboard:

1.5.After rechangestate ends, it automatically jumps back to hintstate and addsGotostateaction:

Change triggertypeStoryboardcompletedtrigger, Statename SelectionHintstate:

So far, the first step has been achieved. This article is too much, and the content is somewhat complicated. I wanted to write it all in one breath. I can't write it today, but I still need to break it down. It's also convenient for everyone to practice.Source codeAnd the final effect.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.