Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
bomb.java
Package: BattleTank1.0.rar [view]
Upload User: jhzhutan
Upload Date: 2021-03-28
Package Size: 374k
Code Size: 2k
Category:
Shot Game
Development Platform:
Java
- import java.awt.*;
- //Download:http://www.codefans.net
- public class bomb implements Actor{
- private int xPos, yPos;
- private int animationTime;
- public final Rectangle border = new Rectangle(0,0,0,0);
- public String size;
- public int inner, middle, outer, jumpDistance;
- public ServerModel gameModel;
- public bomb(int a, int b, String size, ServerModel gameModel){
- this.size = size;
- this.gameModel = gameModel;
- if(size.equals("big") ){
- inner = 6; middle = 9; outer = 14;
- jumpDistance = 8;
- animationTime = 6;
- }else if(size.equals("small")){
- inner = 2; middle = 4; outer = 7;
- jumpDistance = 4;
- animationTime = 4;
- }
- xPos = a;
- yPos = b;
- }
- public void draw(Graphics g){
- g.setColor(Color.red);
- g.fillOval(xPos-outer, yPos-outer, 2*outer, 2*outer);
- g.setColor(Color.orange);
- g.fillOval(xPos-middle, yPos-middle, 2*middle, 2*middle);
- g.setColor(Color.yellow);
- g.fillOval(xPos-inner, yPos-inner, 2*inner, 2*inner);
- }
- public void move(){
- if(gameModel.gamePaused){
- gameModel.outputLine+="o"+ xPos + "," + yPos + "," + size + ";" ;
- return;
- }
- animationTime--;
- if(animationTime < 0){
- gameModel.removeActor(this);
- return;
- }
- xPos = xPos + (int)(Math.random()*jumpDistance) - (int)(Math.random()*jumpDistance);
- yPos = yPos + (int)(Math.random()*jumpDistance) - (int)(Math.random()*jumpDistance);
- //write changes to outputLine
- gameModel.outputLine+="o"+ xPos + "," + yPos + "," + size + ";" ;
- }
- public Rectangle getBorder(){
- return border;
- }
- public String getType(){
- return "bomb";
- }
- //unused method
- public Rectangle[] getDetailedBorder(){return null;}
- public boolean walldestoried(){return false;}
- }