Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Application example Analysis of SurfaceView Class in Android Game Development

2025-03-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

< 0) mHeading += 360; else if (mHeading >

) mHeading-= 360;} / / Base accelerations-- 0 for x, gravity for y double ddx = 0; double ddy =-PHYS_DOWN_ACCEL_SEC * elapsed If (mEngineFiring) {/ / taking 0 as up, 90 as to the right / / cos (deg) is ddy component, sin (deg) is ddx component double elapsedFiring = elapsed; double fuelUsed = elapsedFiring * PHYS_FUEL_SEC / / tricky case where we run out of fuel partway through the / / elapsed if (fuelUsed > mFuel) {elapsedFiring = mFuel / fuelUsed * elapsed; fuelUsed = mFuel / / Oddball case where we adjust the "control" from here mEngineFiring = false;} mFuel-= fuelUsed; / / have this much acceleration from the engine double accel = PHYS_FIRE_ACCEL_SEC * elapsedFiring Double radians = 2 * Math.PI * mHeading / 360; ddx = Math.sin (radians) * accel; ddy + = Math.cos (radians) * accel;} double dxOld = mDX; double dyOld = mDY / / figure speeds for the end of the period mDX + = ddx; mDY + = ddy; / / figure position based on average speed during the period mX + = elapsed * (mDX + dxOld) / 2; mY + = elapsed * (mDY + dyOld) / 2; mLastTime = now / / Evaluate if we have landed... Stop the game double yLowerBound = TARGET_PAD_HEIGHT + mLanderHeight / 2-TARGET_BOTTOM_PADDING; if (mY

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report