[r3]: / trunk / RetroGames / Pong / GameObjects / FB_GOALS / COLLIDE / svnobj  Maximize  Restore  History

Download this file

17 lines (16 with data), 2.0 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
/// A wall is static. So it just gives the impulse back
/// But it gives it back, based on the kind of wall.
METHOD COLLIDE : BOOL
VAR_INPUT
	posIn : POSITION;
	vecIn : VECTOR;
END_VAR
VAR_OUTPUT
// only north and south walls are installed
// So we just have to reflect the y force of the vector
vecOut := vecIn;
IF posIn.iXPos <= 0 OR posIn.iXPos >= iWidth THEN
	vecOut.rVX := 0;
	vecOut.rVY := 0;
	COLLIDE := TRUE;
END_IF