- Swift Game Development(Third Edition)
- Siddharth Shekar Stephen Haney
- 163字
- 2021-07-16 17:37:48
Pushing Pierre forward
This style of game usually moves the world forward at a constant speed. Rather than applying force or impulse, we can manually set a constant velocity for Pierre during every update
. Open the Player.swift
file and add this code at the bottom of the update
function:
// Set a constant velocity to the right: self.physicsBody?.velocity.dx = 200
Run the project. Our protagonist penguin will move forward, past the swarm of bees and through the world. This works well, but you will quickly notice that the ground runs out as Pierre moves forward, as shown in this screenshot:

Recall that our ground is only as wide as the screen width multiplied by six. Rather than extending the ground further, we will move the ground's position at well-timed intervals. Since the ground is made up of repeating tiles, there are many opportunities to jump its position forward seamlessly. We simply need to figure out when the player has travelled the correct distance.
- 專業(yè)圖書館發(fā)展之道
- 高校圖書館門戶網(wǎng)站建設(shè)(谷臻小簡·AI導(dǎo)讀版)
- 現(xiàn)代圖書館全面質(zhì)量管理與創(chuàng)新服務(wù)研究
- Practical Industrial Internet of Things Security
- 博物館與文化浙江建設(shè):浙江省博物館學(xué)會(huì)2017年學(xué)術(shù)研討會(huì)論文集
- 邂逅法學(xué)圖書館:浙江大學(xué)光華法學(xué)院師生原創(chuàng)文集
- 移動(dòng)社交時(shí)代的電子閱讀
- 北疆博物院的故事
- 中外學(xué)術(shù)論文中英文摘要語料庫的創(chuàng)建及應(yīng)用
- 一本書的圖書館之旅:圖書館閱讀推廣十五年
- 基于大數(shù)據(jù)時(shí)代的圖書情報(bào)管理與服務(wù)研究
- 電子文件長期保存:理論與實(shí)踐
- 宋人總集敘錄(增訂本)
- 電子文件管理與電子證據(jù)使用
- 現(xiàn)代圖書館管理與閱讀推廣服務(wù)