⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 detu.java

📁 “贪食蛇”游戏小程序设计与制作。实现贪食蛇游戏的运行
💻 JAVA
字号:
import java.awt.*;
import java.util.Vector;
import java.awt.Point;
import java.awt.event.*;
import java.util.*;
import javax.swing.*;
public class Detu extends Vector{
	Point po;
	int i,j;
	GamePanel gp;
Detu(GamePanel gp){
	this.gp=gp;
}
public void detu_1(){

	for(i=11;i<18;i++){
		for(j=7;j<14;j++){
			po=new Point(i,j);
			this.insertElementAt(po,0);
			gp.screen[po.y][po.x].setBackground(Color.cyan);
			po=new Point(i+28,j);
			this.insertElementAt(po,0);
			gp.screen[po.y][po.x].setBackground(Color.cyan);
			po=new Point(i,j+25);
			this.insertElementAt(po,0);
			gp.screen[po.y][po.x].setBackground(Color.cyan);
			po=new Point(i+28,j+25);
			this.insertElementAt(po,0);
			gp.screen[po.y][po.x].setBackground(Color.cyan);
		}	
	}
}
public void detu_2(){
	for(i=0;i<23;i++){
		for(j=19;j<22;j++){
		
			po=new Point(i,j);
			this.insertElementAt(po,0);
			gp.screen[po.y][po.x].setBackground(Color.cyan);
			po=new Point(57-i,j);
			this.insertElementAt(po,0);
			gp.screen[po.y][po.x].setBackground(Color.cyan);
		}	
	}
}
	
} 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -