1 Star 0 Fork 94

皮蛋solo粥/little-crab-initial

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Lobster.java 625 Bytes
一键复制 编辑 原始数据 按行查看 历史
皮蛋solo粥 提交于 2020-03-29 22:11 . 增加
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class Lobster here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Lobster extends Actor
{
/**
* Act - do whatever the Lobster wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
move(3);
randomTurn();
}
public void randomTurn(){
if(Greenfoot.getRandomNumber(100)<30){
turn(Greenfoot.getRandomNumber(60)-30);
}
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/mei_ni_wang/little-crab-initial.git
git@gitee.com:mei_ni_wang/little-crab-initial.git
mei_ni_wang
little-crab-initial
little-crab-initial
master

搜索帮助