package com.Penguin; import com.util.Constant; import com.util.GameUtil; import java.awt.*; public class Penguin extends GameObject{ boolean left,up,right,down; boolean live=true; public void draw(Graphics g){ //if(live){ g.drawImage(img, (int)x, (int)y, null); move(); //} } //企鹅移动 public void move(){ if(x>= Constant.GAME_WIDTH-width-20) { x=Constant.GAME_WIDTH-width-20; } else if(x<=0){ x=0; } if(y<=30){ y=30; } if (left) { x -= speed; } if (right) { x += speed; } if (up) { y -= speed; } if (down) { y += speed; } } public Penguin(String imgpath, double x, double y) { this.img = GameUtil.getImage(imgpath); this.width=img.getWidth(null); this.height=img.getHeight(null); this.x = x; this.y = y; } public Penguin() { } }
最近下载更多
wybdxjq LV1
2023年12月27日
dacfsdfaa LV1
2022年5月25日
ma小跳 LV5
2021年7月2日
asdffghhj LV1
2021年3月19日
happyzhu LV1
2020年12月17日
TerryGaoBo LV9
2020年8月26日
kkkxyh LV13
2020年8月23日
a105259 LV3
2020年5月9日
xueiqngquan LV1
2019年12月14日
aa123456awww LV8
2019年12月9日