1 Star 0 Fork 91

陈纪康/little-crab-initial

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

搜索帮助