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.