- Hands-On Game Development with WebAssembly
- Rick Battagline
- 258字
- 2021-06-24 13:41:13
Compiling collider.html
The command we use to compile our collider.html file is similar to our compile command in the last chapter. We will need to add a new collider.cpp file into the command line, but other than that it should be the same. Here is the command you use to compile collider.html:
em++ main.cpp collider.cpp ship.cpp enemy_ship.cpp player_ship.cpp projectile.cpp projectile_pool.cpp -std=c++17 --preload-file sprites -s USE_WEBGL2=1 -s USE_SDL=2 -s USE_SDL_IMAGE=2 -s SDL2_IMAGE_FORMATS=["png"] -o collider.html
Now that we have collider.html compiled, we can serve it from our web server of choice, or run it with emrun, and load it into a web browser. Here is what it looks like:

I did not take a screenshot of the entire browser as I have in previous screenshots of the game because I wanted to zoom in on the player ship destroying the enemy ship. As you can see, we now have colliders that can detect when a projectile collides with a spaceship and can destroy that spaceship when the collision happens by running an explosion animation.
- Linux KVM虛擬化架構(gòu)實(shí)戰(zhàn)指南
- BeagleBone By Example
- 硬件產(chǎn)品經(jīng)理成長(zhǎng)手記(全彩)
- 電腦組裝、維護(hù)、維修全能一本通(全彩版)
- 3ds Max Speed Modeling for 3D Artists
- OUYA Game Development by Example
- Rapid BeagleBoard Prototyping with MATLAB and Simulink
- BeagleBone Robotic Projects
- Internet of Things Projects with ESP32
- Wireframing Essentials
- 電腦組裝與維護(hù)即時(shí)通
- 圖解計(jì)算機(jī)組裝與維護(hù)
- Advanced Machine Learning with R
- 51單片機(jī)應(yīng)用開發(fā)從入門到精通
- 新型復(fù)印機(jī)·傳真機(jī)維修數(shù)據(jù)速查寶典