java写的贪食蛇游戏,带简单ai,运行多次后可以出现吃满屏幕的情况。
电脑需要预先安装jdk1.8
git clone https://github.com/guojiank/smart-snake.git
cd smart-snake
./gradlew desktop:dist
生成可运行文件在./desktop/build/libs目录下
运行游戏
java -jar desktop-1.0.jar
打开 idea ,选择 import project , 找到本项目,然后选择 import project from external model 选择 gradle 。
main方法所在目录为 desktop/src/io.github.guojiank.game.desktop/DesktopLauncher 。 启动项目前需要先编辑 Run/Debug configurations 文件。将 working directory 目录修改为资源目录 (我的电脑的资源目录为C:\Users\Administrator\Desktop\workspaces\smart-snake\core\assets) ,然后能启动了