gpt4 book ai didi

javascript - 水平移动背景图像

转载 作者:行者123 更新时间:2023-12-03 11:17:46 26 4
gpt4 key购买 nike

My Game

我制作了一个游戏,其中包含的所有图像都是垂直移动的。我想知道如何水平移动它。

最佳答案

您链接的 jsbin 在我的计算机上无法运行,因此可能存在其他问题。

无论如何,要使背景在游戏中水平移动,您可以找到函数functionBackground(),并将 this.y 赋值更改为this.x(对于例如,this.y += this.speed 将变为 this.x += this.speed)。

关于javascript - 水平移动背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27260219/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com