collider fies
@@ -54,13 +54,29 @@ class Collider
54
54
}
55
55
}
56
56
57
isInBounds(point)
58
{
59
var hw = this.gameObject.transform.size.x / 2;
60
var hh = this.gameObject.transform.size.y / 2;
61
62
if(point.x > this.transform.position.x - hw && point.x < this.transform.position.x + hw)
63
{
64
if(point.y > this.transform.position.y - hh && point.y < this.transform.position.y + hh)
65
{
66
return true;
67
}
68
}
69
70
return false;
71
}
72
57
73
checkCollisions()
58
74
{
59
75
if(this.enabled && !this.gameObject.destroyed)
60
76
{
61
77
for(var i = 0; i < this.gameObject.scene.activeObjects.length; i++)
62
78
{
63
if(this.gameObject.scene.activeObjects[i] != this && this.gameObject.scene.activeObjects[i].ignoreCollisions)
79
if(this.gameObject.scene.activeObjects[i] != this && this.gameObject.scene.activeObjects[i].collider.enabled)
64
80
{
65
81
var hit = false;
66
82
var o2 = this.gameObject.scene.activeObjects[i];
@@ -54,13 +54,29 @@ class Collider54
}54
}55
}55
}56
56
57
isInBounds(point)58
{59
var hw = this.gameObject.transform.size.x / 2;60
var hh = this.gameObject.transform.size.y / 2;61
62
if(point.x > this.transform.position.x - hw && point.x < this.transform.position.x + hw)63
{64
if(point.y > this.transform.position.y - hh && point.y < this.transform.position.y + hh)65
{66
return true;67
}68
}69
70
return false;71
}72
57
checkCollisions()73
checkCollisions()58
{74
{59
if(this.enabled && !this.gameObject.destroyed)75
if(this.enabled && !this.gameObject.destroyed)60
{76
{61
for(var i = 0; i < this.gameObject.scene.activeObjects.length; i++)77
for(var i = 0; i < this.gameObject.scene.activeObjects.length; i++)62
{78
{63
if(this.gameObject.scene.activeObjects[i] != this && this.gameObject.scene.activeObjects[i].ignoreCollisions)79
if(this.gameObject.scene.activeObjects[i] != this && this.gameObject.scene.activeObjects[i].collider.enabled)64
{80
{65
var hit = false;81
var hit = false;66
var o2 = this.gameObject.scene.activeObjects[i];82
var o2 = this.gameObject.scene.activeObjects[i];@@ -1,4 +1,3 @@
1
2
1
class vector
3
2
{
4
3
x = 0;
@@ -11,6 +10,11 @@ class vector
11
10
this.y = y;
12
11
}
13
12
13
get length()
14
{
15
return this.length();
16
}
17
14
18
length()
15
19
{
16
20
return Math.sqrt((this.x * this.x) + (this.y * this.y));
@@ -1,4 +1,3 @@1
2
class vector1
class vector3
{2
{4
x = 0;3
x = 0;@@ -11,6 +10,11 @@ class vector11
this.y = y;10
this.y = y;12
}11
}13
12
13
get length()14
{15
return this.length();16
}17
14
length()18
length()15
{19
{16
return Math.sqrt((this.x * this.x) + (this.y * this.y));20
return Math.sqrt((this.x * this.x) + (this.y * this.y));