Breach

Check-in [5d032bf725]
Login

Check-in [5d032bf725]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:removed the fixangle functions as they are now obsolete
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5d032bf7253e935d4a3398a5da7fb8d38271a64f
User & Date: donnyjward@gmail.com 2010-11-11 06:12:47.000
Context
2010-11-12
05:34
made it so that the angle calculation for the paddle is rounded now. ball class cleaned up a little bit and renamed Aircraft check-in: 3e5da8e2c2 user: donnyjward@gmail.com tags: trunk
2010-11-11
06:12
removed the fixangle functions as they are now obsolete check-in: 5d032bf725 user: donnyjward@gmail.com tags: trunk
05:26
machien gun bullets now collide with balls and destroy them. I will now base an airplane class off of the ball with the intention of it flying back and forth on the top of the screen. the player can destroy it by hitting it a few times check-in: efcb02db80 user: donnyjward@gmail.com tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to breach.cpp.
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
void b_getUnitVector(const int & x1, const int & y1, double & x2, double & y2);

//weapon cooldown in seconds
//FIXME: make it so these values are read from a file instead of h4rd c0ded
extern const double weaponCoolDowns[] = 
{
	0.1,	//machine gun
	0.5,	//flak
	2	//rocket
};

extern const double MGUN_SPEED = 5; //10 pixels per frame


//target frame rate







|







66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
void b_getUnitVector(const int & x1, const int & y1, double & x2, double & y2);

//weapon cooldown in seconds
//FIXME: make it so these values are read from a file instead of h4rd c0ded
extern const double weaponCoolDowns[] = 
{
	0.1,	//machine gun
	0.4,	//flak
	2	//rocket
};

extern const double MGUN_SPEED = 5; //10 pixels per frame


//target frame rate
Changes to g_gameobject.cpp.
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234

}

int GameObject::GetAngle()
{

}
/*
//right now only used by paddle, declared in paddle subclass
void GameObject::FixAngle()
{
	while (angle >= 360)
		angle -= 360;
}
*/
/************************************************
*                                               *
*	Item                                    *
*                                               *
************************************************/
Item::Item()
{







<
<
<
|
<
<
<
<







213
214
215
216
217
218
219



220




221
222
223
224
225
226
227

}

int GameObject::GetAngle()
{

}








/************************************************
*                                               *
*	Item                                    *
*                                               *
************************************************/
Item::Item()
{
313
314
315
316
317
318
319
320
321
322





323
324
325
326
327
328
329
//int GetAngle();
		
Block::~Block()
{

}

//void FixAngle();
//bool TryMove();






Projectile::Projectile(int startX, int startY, int velocityX, int velocityY, weaponType_t weaponType)
: xVelocity(velocityX), yVelocity(velocityY)
{
	SetLoc(startX, startY);
	
	//FIXME: determine radius, image, etc by weaponType. values
	//	will be stored in a .dat file







<


>
>
>
>
>







306
307
308
309
310
311
312

313
314
315
316
317
318
319
320
321
322
323
324
325
326
//int GetAngle();
		
Block::~Block()
{

}


//bool TryMove();

/************************************************
*                                               *
*	Projectile                              *
*                                               *
************************************************/
Projectile::Projectile(int startX, int startY, int velocityX, int velocityY, weaponType_t weaponType)
: xVelocity(velocityX), yVelocity(velocityY)
{
	SetLoc(startX, startY);
	
	//FIXME: determine radius, image, etc by weaponType. values
	//	will be stored in a .dat file
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
		Kill();
	else
		SetLoc(xDest, yDest);
	
	return !blocked;	
}

void Projectile::FixAngle(int & angle)
{

}

/************************************************
*                                               *
*	Ball                                    *
*                                               *
************************************************/
Ball::Ball()
{







<
<
<
<
<







452
453
454
455
456
457
458





459
460
461
462
463
464
465
		Kill();
	else
		SetLoc(xDest, yDest);
	
	return !blocked;	
}






/************************************************
*                                               *
*	Ball                                    *
*                                               *
************************************************/
Ball::Ball()
{
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
int Ball::getRadius()
{
	return radius;
}

//int Ball::GetSpeed();
//int Ball::GetAngle();
//void Ball;;FixAngle(int & angle);

bool Ball::TryMove(int mouseX, int mouseY)
{
	int xDest, yDest;
	GetLoc(xDest, yDest);
	int xBallCenter, yBallCenter;
	double distance;







<







539
540
541
542
543
544
545

546
547
548
549
550
551
552
int Ball::getRadius()
{
	return radius;
}

//int Ball::GetSpeed();
//int Ball::GetAngle();


bool Ball::TryMove(int mouseX, int mouseY)
{
	int xDest, yDest;
	GetLoc(xDest, yDest);
	int xBallCenter, yBallCenter;
	double distance;
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
		}
	}
	else
	{
		//cout << fileID << "safe...\n";
	}	
	SetLoc(xDest, yDest);
}

void Ball::FixAngle(int & angle)
{

}

/************************************************
*                                               *
*	Wall Section                            *
*                                               *
************************************************/







<
<
<
<
<







589
590
591
592
593
594
595





596
597
598
599
600
601
602
		}
	}
	else
	{
		//cout << fileID << "safe...\n";
	}	
	SetLoc(xDest, yDest);





}

/************************************************
*                                               *
*	Wall Section                            *
*                                               *
************************************************/
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
{
	return OBJECT_PADDLE;
}
		
//int GetSpeed();
//int GetAngle();

void Paddle::FixAngle(int & angle)
{
	while (angle >= 360)
		angle -= 360;
		
	while (angle < 0)
		angle -= 360;
}

//takes the position of the mouse cursor and points the paddle
//	at it. does nothing if the cursor is inside the radius
//	of the paddle.
bool Paddle::TryMove(int xAbsolute, int yAbsolute)
{
	//FIXME: for some reason the paddle doesnt point







<
<
<
<
<
<
<
<







747
748
749
750
751
752
753








754
755
756
757
758
759
760
{
	return OBJECT_PADDLE;
}
		
//int GetSpeed();
//int GetAngle();










//takes the position of the mouse cursor and points the paddle
//	at it. does nothing if the cursor is inside the radius
//	of the paddle.
bool Paddle::TryMove(int xAbsolute, int yAbsolute)
{
	//FIXME: for some reason the paddle doesnt point
Changes to g_gameobject.h.
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
		bool ShouldDie();
		virtual int GetSpeed();
		virtual int GetAngle();
		
		virtual int getRadius() { };
		
		virtual ~GameObject() { };
		//FixAngle only needed by paddle
		//FIXME: fixangle should be obsolete now with new Paddle::TryMove function
		virtual void FixAngle(int & angle) =0; //possibly make this virtual and only include in classes that will need it
		virtual bool TryMove(int x, int y) =0;
		
	private:
		//current location
		int x;
		int y;
		







|
<
<







32
33
34
35
36
37
38
39


40
41
42
43
44
45
46
		bool ShouldDie();
		virtual int GetSpeed();
		virtual int GetAngle();
		
		virtual int getRadius() { };
		
		virtual ~GameObject() { };



		virtual bool TryMove(int x, int y) =0;
		
	private:
		//current location
		int x;
		int y;
		
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
		
		int getRadius();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Projectile();
		
		void FixAngle(int & angle);
		bool TryMove(int x, int y);
				
	private:
		weaponType_t weaponType;
		
		int radius;
		







|
<







65
66
67
68
69
70
71
72

73
74
75
76
77
78
79
		
		int getRadius();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Projectile();


		bool TryMove(int x, int y);
				
	private:
		weaponType_t weaponType;
		
		int radius;
		
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
		
		int getRadius();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Ball();
		
		void FixAngle(int & angle);
		bool TryMove(int x, int y);
		
	private:
		int radius;
		
		//in pixels per frame, cartesian coords
		int xVelocity;







|
<







102
103
104
105
106
107
108
109

110
111
112
113
114
115
116
		
		int getRadius();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Ball();


		bool TryMove(int x, int y);
		
	private:
		int radius;
		
		//in pixels per frame, cartesian coords
		int xVelocity;
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Item();
		
		//void FixAngle(int & angle);
		//bool TryMove();
		
	private:
		itemType_t itemType;
};

class Block : public GameObject







<







131
132
133
134
135
136
137

138
139
140
141
142
143
144
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Item();
		

		//bool TryMove();
		
	private:
		itemType_t itemType;
};

class Block : public GameObject
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
		//void SetLoc(int & xloc, int & yloc);
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Block();
		
		//void FixAngle(int & angle);
		//bool TryMove();
		
	private:
		bool isSoft;
		Item * containedItem;
};








|
<







153
154
155
156
157
158
159
160

161
162
163
164
165
166
167
		//void SetLoc(int & xloc, int & yloc);
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Block();


		//bool TryMove();
		
	private:
		bool isSoft;
		Item * containedItem;
};

191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Paddle();
		
		void FixAngle(int & angle);
		bool TryMove(int xAbsolute, int yAbsolute);
		
		void requestShooting(bool request); //left click
		void requestMissleLaunch(bool request); //right click
		
	private:
		//positive angle direction is counter clockwise







<







185
186
187
188
189
190
191

192
193
194
195
196
197
198
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~Paddle();
		

		bool TryMove(int xAbsolute, int yAbsolute);
		
		void requestShooting(bool request); //left click
		void requestMissleLaunch(bool request); //right click
		
	private:
		//positive angle direction is counter clockwise
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~WallSection();
		
		//void FixAngle(int & angle);
		bool TryMove();
		
	private:
		bool isSpiky;
};

//manages all the game objects on a level







<







227
228
229
230
231
232
233

234
235
236
237
238
239
240
		objectType_t GetObjectType();
		
		//int GetSpeed();
		//int GetAngle();
		
		~WallSection();
		

		bool TryMove();
		
	private:
		bool isSpiky;
};

//manages all the game objects on a level