My favorites
▼
|
Sign in
android-gamedev
Android Game Development Tutorial Code
Project Home
Downloads
Wiki
Issues
Source
Checkout
Browse
Changes
Source path:
svn
/
trunk
/
src
/
com
/
badlogic
/
gamedev
/
spaceinvaders
/
simulation
/
Vector.java
‹r43
r71
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
package com.badlogic.gamedev.spaceinvaders.simulation;
import java.io.Serializable;
import android.util.FloatMath;
public class Vector implements Serializable
{
public float x, y, z;
public Vector( float x, float y, float z )
{
this.x = x;
this.y = y;
this.z = z;
}
public Vector( )
{
x = y = z = 0;
}
public Vector( Vector v )
{
set( v );
}
public void set( Vector v )
{
this.x = v.x;
this.y = v.y;
this.z = v.z;
}
public Vector add( Vector v )
{
this.x += v.x;
this.y += v.y;
this.z += v.z;
return this;
}
public Vector sub( Vector v )
{
this.x -= v.x;
this.y -= v.y;
this.z -= v.z;
return this;
}
public void set(float x, float y, float z)
{
this.x = x;
this.y = y;
this.z = z;
}
public float distance(Vector v)
{
float a = v.x - x;
float b = v.y - y;
float c = v.z - z;
return FloatMath.sqrt( a * a + b * b + c * c );
}
}
Show details
Hide details
Change log
r54
by quantumgame on Jan 14, 2010
Diff
[No log message]
Go to:
...spaceinvaders/SpaceInvaders.java
...ceinvaders/screens/GameLoop.java
...ceinvaders/simulation/Block.java
...vaders/simulation/Explosion.java
...invaders/simulation/Invader.java
...aceinvaders/simulation/Ship.java
...aceinvaders/simulation/Shot.java
...aders/simulation/Simulation.java
...einvaders/simulation/Vector.java
Project members,
sign in
to write a code review
Older revisions
r43
by quantumgame on Jan 11, 2010
Diff
[No log message]
r35
by quantumgame on Jan 10, 2010
Diff
[No log message]
r34
by quantumgame on Jan 10, 2010
Diff
[No log message]
All revisions of this file
File info
Size: 919 bytes, 65 lines
View raw file
Powered by
Google Project Hosting