如何反转它的 Y 轴运动?
我正在为 iPhone 制作一款涉及吹口哨的小游戏。手机会听到您口哨的频率,并相应地设置精灵在屏幕上的位置。代码如下:
if frequency > 1000 then
soundbar.y = (frequency-1020)/10+30
end
这使得条形在 y 轴上在 30 和更高的位置之间移动,最高的啸叫寄存器位于 y 400 左右,这很好。 只有一个问题。你吹得越高越高,酒吧就向下越远。有什么方法可以编辑我的公式,使栏从 208 开始,并且随着音调的增加,栏上升?
谢谢:)这让我困惑了一段时间!
I'm making a little game for iPhone that involves whistling. The phone hears the frequency of your whistle, and sets the position of a sprite on the screen accordingly. Here is the code:
if frequency > 1000 then
soundbar.y = (frequency-1020)/10+30
end
This makes the bar move between 30 and higher on the y axis, with the highest whistling register being at about y 400, which is fine.
There is only one problem. The higher you whistle, the further down the bar goes. Is there any way I can edit my formula, so that the bar starts at 208, and as the pitch increases, the bar rises?
Thanks :) This has had me stumped for a while!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这简化为...
甚至...
which simplifies to...
or even...