Let me explain first, it is not a title party. If you are interested, please read the
specific code and see the warehouse: https://github.com/uiuing/spx
First look at the effect
This GIF 43 seconds
GitHub repository: https://github.com/uiuing/spx
origin
I got up this morning to brush the GO+ community and saw an article by the big guy: https://bbs.csdn.net/topics/603582959
Then I became interested in an instant, and then made up the official video: https://bbs.csdn.net/topics/603487787
learning process
My understanding is still a bit vague, so I won't discuss the technical content here . I don't care about
it, so I went directly to the warehouse to pull a running demo: https://github.com/goplus/spx , follow Xu Da's tutorial step by step
Then cloned to the local, with the tutorial of the warehouse
tutorial
Combine it and read the cases in it slowly ,
then tutorial
run through the cases in it, continue to deepen the understanding,
and test
then run the cases in it again.
Although there is no spx code highlighting, it is still very comfortable to understand. After all, GO+ is very suitable for As an introductory language for teenagers to learn programming
hands-on
frame up
Now that the code has been read once, if you want to deepen your understanding, you have to implement it yourself.
Refer to the case in the warehouse 05-Animation
and 04-Bullet
write a small game about "eliminating viruses"
.
06-DestroyVirus
- res : some files for settings
- sounds : sound files
- bgm : background music
- hit : the sound effect of the virus being eliminated
- sprites : some "sprites"
- MyMedicine : Needle
- Virus : virus
- backdrop.png : background image
- index.json : global settings
- sounds : sound files
- index.gmx : global configuration
- MyMedicine.spx : Needle configuration
- Virus.spx : Virus configuration
Please note that I am not a professional game developer, so the game configuration here is only a rough understanding.
For example , sprites : Sprites are concepts from game development, although sprites are not a multi-sound translation, but the de facto standard Or the tradition already exists.
If there are any mistakes, please correct me!
res
Directory Structure
sounds
Make a picture
make background
其他的配图
Blue virus ICON:https://www.iconfont.cn/user/detail?spm=a313x.7781069.0.d214f71f6&uid=207078
Needle ICON : https://www.iconfont.cn/user/detail?spm=a313x.7781069.0.d214f71f6&uid=4176001
Create a shattering effect
sprite
MyMedicine
Configure the needle map first
Virus
The next step is to configure the virus, in addition to the basic style, you also need to add the broken effect after clicking
res global configuration
The background is mainly configured here, the above modules are imported, and a timing effect is added
index.gmx
These modules are mainly imported here, including 针管
, 病毒
, sound effects, and background music
. Three variables are used for: timing, virus generation time, and virus falling speed.
MyMedicine.spx
onStart
Let the MyMedicine
sticker find the mouse position and play background music
Virus.spx
Here, let 病毒
it be automatically generated at intervals, and set a random drop position. In addition, it has also added the condition of automatically randomizing the above whenever the time increases by 10 seconds.
Of course, if it is clicked 病毒
, 病毒
it will disappear.
Summarize
Although there are still many regrets in this attempt, for example, it has not been realized: failure, pause and other effects, but I am still very satisfied. This time I feel the ease of learning of GO+ spx. It takes about five hours from learning to production.