当前位置:网站首页>[IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games
[IVX junior engineer training course 10 papers to get certificates] 03 events and guessing numbers games
2022-07-02 01:14:00 【1_ bit】
Catalog
【iVX Junior engineer training course 10 Textual evidence 】01 understand iVX Complete the New Year greeting card
【iVX Junior engineer training course 10 Textual evidence 】02 Numerical binding and adaptive website production
【iVX Junior engineer training course 10 Textual evidence 】03 Events and guessing numbers games
【iVX Junior engineer training course 10 Textual evidence 】04 Canvas and me iVX Group photo
【iVX Junior engineer training course 10 Textual evidence 】05 Canvas and aircraft war game production
【iVX Junior engineer training course 10 Textual evidence 】06 Database and services
【iVX Junior engineer training course 10 Textual evidence 】07 08 News page making
【iVX Junior engineer training course 10 Textual evidence 】09 Chat room production
For high score promotion, please check the column :
iVX Beginner to master
Big talk IVX From actual combat to mastery
One 、 What is an event
stay ivx Events in are the key to interaction , For example, click a button 、 A text or any component will trigger a click event , The process after the trigger response of the event .
1.1 stay ivx How to use event triggering and process editing in
stay ivx Triggering events in is simple , Let's take a button under absolute positioning as an example .
Select the component to which you want to add the event , Then click the event button :
The event will be added and the event editing area will be entered , And you can find , In the event trigger, you can select a variety of trigger events :
1.2 Four elements of interaction
Generally, when an event is triggered , A typical example is the click of a button , This event trigger is interactive ( Non interactive triggering is roughly the same as interactive triggering events ); Now let's edit the event and check the trigger elements .
First, draw a text in the page , Let's click the button to change the text of this text .
Then select the trigger event from the events of the button to click :
Then we found out , There is also a green event editing area under the click time , This edit area represents the action , That is, what action you want to complete after you click this button to trigger this click event ; After completing the action, we can select an object through the arrow to make some changes , The arrow for selecting objects is shown in the following figure :
After clicking the arrow , Select the component to be operated in the object tree :
Then in the action selection , Select the type of change :
Here I choose to set properties , Change the text content from the property :
Then click the button in the preview interface to change the text :
Now we can see that , The four elements of an event are : Departure object ( Trigger events through a component )、 What events trigger 、 Target audience ( What do you want )、 action ( What to do ).
Two 、 Guess number game production
2.1 Page drawing
To make a number guessing game, we have to draw the corresponding page first , Interface drawing is very simple , Draw with absolute positioning , The page has two , One is the game start interface , Another is the game interface , The interface is as follows :

The buttons drawn above have sharp corners. You only need to find the border and fillet in the button properties and change the fillet position :
2.2 Page Jump
First , The first function we need to complete should be to jump to the page , Click start and jump to another page ; At this point, we can think of , After you click the start button , It's a click event , Let's add an event to the button :
How to jump events ?
We just need to select the object of the selection operation as the foreground of the object tree , The front desk can be responsible for jumping to the page :
Then select jump page in the action :
Finally, select the page as page 2 :
At this point, we can preview and click this button to jump to the page .
2.3 Random number generation
Because our game is a number guessing game , Then the first thing after jumping to the page should be to generate two random numbers , This random number is the range of guessed numbers , How to generate random numbers ?
At this point, we can create two numerical variables :
You can also rename these two numeric variables , One is named high 、 One is named low , Low indicates a small number and high indicates a large number :
Then we need to start generating random values when we enter this page , So it's very simple , Just give the page 2 A display time , Select Page 2 Click event :
After selecting the event , Next, we need to generate random values for these two variables , Then the natural and selected operation objects are these two variables , Let's choose high variables first :
Then you can see an action to generate random integers in the action :
After selection, you can find that you need to give a random number interval , Since it is high value , Then give 50 To 100 The scope is just :
Then operate on the low variable again , Click the plus sign to create a new action :
And give the corresponding range :
At this point, we can get two random ranges , Next, you need to display this range on the page , The display is simple , Just bind the corresponding value :
When the binding is complete , Click to preview the current page and remember to see the random value ( The full preview will start from the first page ):

Guess the range of numbers, but we have to guess the number, but we haven't got it yet , Just create another numeric variable , And set the interval to the high and low values just randomly generated :
2.4 Guess the logic of numbers
Next comes the last step , Input number , Then click OK to match the values .
First, let's give a click event to the OK button on the guess number interface :

Then click on the event column , Adding conditions :
Drag the green action module into the condition :
Select the contents of the input box in the condition :
Next, judge whether the content of the input box is equal to the guessed value :
If the guess is correct, find the prompt text in the action and change the text content to correct :
Then right-click to copy the judgment condition :
Click the event shortcut key to paste two events , And change whether the judgment condition is large or small , And give different hints :
边栏推荐
- Part 29 supplement (XXIX) basis of ECMAScript
- The concept and application of Cartland number
- 969 interlaced string
- 【图像增强】基于Frangi滤波器实现血管图像增强附matlab代码
- Datawhale community blackboard newspaper (issue 1)
- [eight sorting ③] quick sorting (dynamic graph deduction Hoare method, digging method, front and back pointer method)
- Creation of volume group for AIX storage management (I)
- Picture puzzle wechat applet source code_ Support multi template production and traffic master
- Excel search and reference function
- 学习笔记2--高精度地图定义及价值
猜你喜欢

Edge extraction edges based on Halcon learning_ image. Hdev routine

Principle of finding combinatorial number and template code

Schrodinger's Japanese learning applet source code

Entrepreneurship is a little risky. Read the data and do a business analysis

Datawhale 社区黑板报(第1期)

Source code of Qiwei automatic card issuing system

Sql--- related transactions

Exclusive delivery of secret script move disassembly (the first time)

学习笔记3--高精度地图关键技术(上)

What skills does an excellent software tester need to master?
随机推荐
Datawhale 社区黑板报(第1期)
Cat Party (Easy Edition)
2022 safety officer-a certificate examination questions and online simulation examination
The author is more willing to regard industrial Internet as a concept much richer than consumer Internet
XMIND mind map
Upgraded wechat tool applet source code for mobile phone detection - supports a variety of main traffic modes
About asp Net core uses a small detail of datetime date type parameter
ACM tutorial - quick sort (regular + tail recursion + random benchmark)
MySQL winter vacation self-study 2022 12 (4)
学习笔记3--高精度地图关键技术(上)
2022 operation of simulated examination platform for melting welding and thermal cutting work license
Entrepreneurship is a little risky. Read the data and do a business analysis
Daily work and study notes
Sql--- related transactions
AIX存储管理之总结篇
Keepalived introduction and installation
什么是商业养老保险?商业养老保险安全靠谱吗?
Bilstm CRF code implementation
Variables and constants of go language foundation
Exclusive delivery of secret script move disassembly (the first time)