File: hazard_collide.txt

package info (click to toggle)
nikwi 0.0.20120213-7
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 8,628 kB
  • sloc: cpp: 7,111; ansic: 880; objc: 247; makefile: 143; sh: 48
file content (29 lines) | stat: -rw-r--r-- 634 bytes parent folder | download | duplicates (6)
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
#
# Collision event handler for hazards
#

Object	obj = getThisObject();
Object	other = getOtherObject();

if (other == getHero())
{
	float	a = 0.0;
	int	x = getObjectXPosition(other) + 16;
	int	y = getObjectYPosition(other) + 16;
	while (a < 360.0)
	{
		createParticleObject(makeCode("par1"), x, y, a, 3.0,60);
		createParticleObject(makeCode("par1"), x, y, a, 4.0,60);
		a = a + 25.0;
	}
	
	Object	glass = createObject(makeCode("nikg"), x - 16, y - 16);
	setObjectLife(glass, 300);
	createPhysicsController(glass);
	copyObjectOrientation(glass, other);
	setObjectGravity(glass, 0.2);
	setObjectBounce(glass, 0.8);
	
	loseLife();
}