File: wall.d

package info (click to toggle)
tatan 1.0.dfsg1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,548 kB
  • sloc: xml: 57; makefile: 31
file content (92 lines) | stat: -rw-r--r-- 1,973 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
module br.wall;

private import util.parts;
private import util.particle;
private import util.collision;
private import br.shapeImpl;
private import br.screen;
private import br.mainloop;
private import br.gamemanager;

public void makeWall(string type ,Vector3 pos ,Vector3 vel ,Object par = null){
	switch(type){
		case "1" : new Wall1(pos ,vel); break;
		
		default:break;
	}
}

public class Wall:Parts{

//	int hp;
	public this(Vector3 pos ,float size=30.0f){
		collisionManager.add(this ,collisionManager.kind.SHIP ,2);
		collisionManager.add(this ,collisionManager.kind.SHOT ,2);
		collisionManager.add(this ,collisionManager.kind.WALL ,1);
		this.pos = cast(Vector3)pos.clone();
		rpos = cast(Vector3)pos.clone();
		
		drawing =   POLYGON | WIRE;
		
		wR = 0.0;wG =0.0f;wB = 0.0f;walpha = 1.0;
		
		this.size = size;
		collisionRange = size / 2.0f;
		
		wallManager.add(this);
		
//		hp = 3;
	}
	
	public override void move(){
		super.move();
		if((rpos.y+size < screen.GAME_DOWN || screen.GAME_UP < rpos.y-size ||
			screen.GAME_RIGHT  < rpos.x-size || rpos.x+size < screen.GAME_LEFT ||
			screen.GAME_NEAR < rpos.z - size || rpos.z + size < screen.GAME_FAR
			
		)){
			vanish();
		}
		
	}
	public override void reportCollision(int kind ,Parts p){
		switch(kind){
//			case CollisionManager.kind.SHIP:
//			destroy();
//			break;
			default:break;
		}
		
	}
	public override void destroy(){
		super.destroy();
//		makeParticle(shape, size ,WIRE ,rpos ,new Vector3() ,rpose ,R ,G ,B ,alpha);

	}
	
}

public class Wall1:Wall{
	public:
	Vector3 vel;
	
	public this(Vector3 pos ,Vector3 vel){
		super(pos ,30.0f);
		this.vel = cast(Vector3)vel.clone();
		
		shape = Cube.getShape();
		
		
		R = 0.88;G =1.0;B = 0.9;alpha = 1.0;
		
		poseZ = atan2(vel.y,vel.x)*180.0/PI;
	}
	public override void move(){
		super.move();
		
		pos += mulsp(vel);
		
		poseX += mulsp(2f);
	}
	
}