官术网_书友最值得收藏!

Basic Particle System

A particle system is a graphics technique where we emit a large number of sprites from an emitter and have those sprites go through a life cycle where they change in a variety of ways. We build some randomness into our sprite life cycle to create a wide range of interesting effects such as explosions, sparks, snow, dust, fire, engine exhaust, and so on. Some particle effects can interact with their environment. In our game, we are going to use particle effects to create nice-looking engine exhaust and ship explosion effects.

For this chapter, you will need to include several images in your build to make this project work. Make sure you include the /Chapter08/sprites/ folder from the project's GitHub. If you haven't yet downloaded the GitHub project, you can get it online here:  https://github.com/PacktPublishing/Hands-On-Game-Develop.

This chapter and the beginning of the next one are going to feel like a digression at first. We will be spending a lot of time in the following two chapters working on something other than our game. If you are interested in particle systems, I promise it will be worth it. When you create a particle system, you spend a lot of time tweaking them and playing with them to get them to look right. To do this directly within the game will result in a lot of compiling and testing. What we need is a tool where we can configure and test a particle system before we add it to our game. This chapter and half of the next chapter are dedicated to building this tool. If you are not interested in learning how to build the tool, you can skim the text in this chapter, and download and compile the tool from GitHub. If you are as interested in learning how JavaScript, HTML, and WebAssembly can interact in an application, this chapter and the first half of Chapter 9, Improved Particle Systems, are a good tutorial for learning how to write an application and not just a game with WebAssembly.

In this chapter, we're going to cover the following topics:

  • A brief introduction to SVG
  • Trigonometry again?
  • Adding the JavaScript
  • The simple particle emitter tool
  • The Point class
  • The Particle Class
  • The Emitter Class
  • WebAssembly interface functions
  • Compiling and testing the particle emitter
主站蜘蛛池模板: 东台市| 临沂市| 固原市| 谢通门县| 浪卡子县| 澄江县| 洛阳市| 彰化市| 巫溪县| 巴林右旗| 万州区| 吴江市| 洛宁县| 桑日县| 富裕县| 沾益县| 邯郸县| 鹰潭市| 永德县| 连南| 肥西县| 信丰县| 北票市| 阿尔山市| 朝阳市| 盖州市| 宜章县| 新河县| 昭觉县| 宜良县| 喜德县| 阿尔山市| 庄浪县| 斗六市| 汨罗市| 博爱县| 北川| 汉源县| 紫金县| 全南县| 温泉县|