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

Chapter 3. Interacting with the User

The main loop is your game's Dungeon Master, referee, and director: it listens for user input, updates the game state, and renders the output. In a game of Blockout, the loop drops blocks and clears finished layers. In a car racer, the loop calculates friction and acceleration. In a first-person shooter, the loop respawns enemies. The loop is where you make sure everyone sticks to the rules, and where you determine whether the player has won or lost.

In the previous chapter, we learnt how to initialize a 3D scene using the simpleInitApp() method from the SimpleApplication class. You can translate, scale, and rotate objects into their start positions, and navigate the scene using the mouse and W, A, S, and D keys. But the scene is still static—we need some interaction!

In this chapter you will learn:

  • How to respond to user input
  • How to determine the target of a user action
  • How to trigger game actions
  • How to steer game characters

Let's make the application come alive.

主站蜘蛛池模板: 射阳县| 芜湖市| 宝丰县| 循化| 伊吾县| 马龙县| 长垣县| 榕江县| 临漳县| 保亭| 宜兰县| 和平区| 稷山县| 马公市| 龙江县| 宁城县| 武鸣县| 安丘市| 南开区| 桑植县| 汾阳市| 临沧市| 澜沧| 固镇县| 延津县| 右玉县| 开原市| 榆林市| 壶关县| 姚安县| 浦东新区| 介休市| 千阳县| 洛南县| 西藏| 长沙市| 马鞍山市| 乌拉特中旗| 安仁县| 万年县| 泰州市|