1 Star 0 Fork 114

gcaog/little-crab-initial

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
Lobster.java 878 Bytes
一键复制 编辑 原始数据 按行查看 历史
gcaog 提交于 2021-04-23 18:48 . add Lobster.java.
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.
*/
int f=1;
public void act()
{
// Add your action code here.
move(4);
more();
eat();
}
public void more(){
int dgree = Greenfoot.getRandomNumber(30);
turn(dgree-15);
}
public void eat(){
if(isTouching(Crab.class)){
removeTouching(Crab.class);
CrabWorld world =(CrabWorld)getWorld();
f=0;
world.abc2(f);
}
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Java
1
https://gitee.com/gtx123456789/little-crab-initial.git
[email protected]:gtx123456789/little-crab-initial.git
gtx123456789
little-crab-initial
little-crab-initial
master

搜索帮助