Skip to content

Commit 816f698

Browse files
committed
update 3.8.5.8
1 parent 08e7cd1 commit 816f698

11 files changed

Lines changed: 3635 additions & 3696 deletions
5.3 KB
Binary file not shown.

‎demos/collision_triangle/html5game/collision_triangle.js‎

Lines changed: 0 additions & 3588 deletions
This file was deleted.

‎demos/collision_triangle/html5game/collision_triangle_demo.js‎

Lines changed: 3441 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
3.61 KB
Loading
151 KB
Loading
Binary file not shown.

‎demos/collision_triangle/html5game/sound/worklets/audio-worklet.js‎

Lines changed: 50 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 80 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,119 @@
11
<!DOCTYPE html>
22
<html lang="en">
3+
4+
<!-- Custom PreHead code is injected here -->
5+
6+
37
<head>
4-
<!-- Generated by GameMaker:Studio http://www.yoyogames.com/gamemaker/studio -->
58
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
6-
<meta http-equiv="pragma" content="no-cache"/>
79
<meta name="apple-mobile-web-app-capable" content="yes" />
810
<meta name ="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
911
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
1012
<meta charset="utf-8"/>
1113

14+
<!-- Builtin injector for disabling cache -->
15+
<meta http-equiv="pragma" content="no-cache"/>
16+
1217
<!-- Set the title bar of the page -->
1318
<title>Created with GameMaker</title>
1419

20+
<!-- Custom PreStyle code is injected here -->
21+
22+
1523
<!-- Set the background colour of the document -->
1624
<style>
1725
body {
18-
background: #0;
19-
color:#cccccc;
20-
margin: 0px;
21-
padding: 0px;
22-
border: 0px;
26+
background: #0;
27+
color: #cccccc;
28+
margin: 0px;
29+
padding: 0px;
30+
border: 0px;
2331
}
32+
2433
canvas {
25-
image-rendering: optimizeSpeed;
26-
-webkit-interpolation-mode: nearest-neighbor;
27-
-ms-touch-action: none;
28-
margin: 0px;
29-
padding: 0px;
30-
border: 0px;
34+
image-rendering: optimizeSpeed;
35+
-webkit-interpolation-mode: nearest-neighbor;
36+
-ms-touch-action: none;
37+
touch-action: none;
38+
margin: 0px;
39+
padding: 0px;
40+
border: 0px;
3141
}
3242
:-webkit-full-screen #canvas {
33-
width: 100%;
34-
height: 100%;
43+
width: 100%;
44+
height: 100%;
3545
}
36-
div.gm4html5_div_class
37-
{
38-
margin: 0px;
39-
padding: 0px;
40-
border: 0px;
46+
:-webkit-full-screen {
47+
width: 100%;
48+
height: 100%;
4149
}
42-
/* START - Login Dialog Box */
43-
div.gm4html5_login
44-
{
45-
padding: 20px;
46-
position: absolute;
47-
border: solid 2px #000000;
48-
background-color: #404040;
49-
color:#00ff00;
50-
border-radius: 15px;
51-
box-shadow: #101010 20px 20px 40px;
50+
51+
/* Custom Runner Styles */
52+
div.gm4html5_div_class {
53+
margin: 0px;
54+
padding: 0px;
55+
border: 0px;
5256
}
53-
div.gm4html5_cancel_button
54-
{
55-
float: right;
57+
div.gm4html5_login {
58+
padding: 20px;
59+
position: absolute;
60+
border: solid 2px #000000;
61+
background-color: #404040;
62+
color:#00ff00;
63+
border-radius: 15px;
64+
box-shadow: #101010 20px 20px 40px;
5665
}
57-
div.gm4html5_login_button
58-
{
59-
float: left;
66+
div.gm4html5_cancel_button {
67+
float: right;
6068
}
61-
div.gm4html5_login_header
62-
{
63-
text-align: center;
69+
div.gm4html5_login_button {
70+
float: left;
6471
}
65-
/* END - Login Dialog Box */
66-
:-webkit-full-screen {
67-
width: 100%;
68-
height: 100%;
72+
div.gm4html5_login_header {
73+
text-align: center;
6974
}
75+
/* END - Custom Runner Styles */
76+
7077
</style>
78+
79+
<!-- Custom PostStyle code is injected here -->
80+
81+
82+
<!-- Builtin injector for injecting flurry analytics code -->
83+
7184
</head>
7285

86+
<!-- Custom PostHead code is injected here -->
87+
88+
89+
<!-- Custom PreBody code is injected here -->
90+
91+
7392
<body>
7493
<div class="gm4html5_div_class" id="gm4html5_div_id">
94+
95+
<!-- Builtin injector for splash screen -->
96+
97+
7598
<!-- Create the canvas element the game draws to -->
7699
<canvas id="canvas" width="725" height="360" >
77-
<p>Your browser doesn't support HTML5 canvas.</p>
100+
<p>Your browser doesn't support HTML5 canvas.</p>
78101
</canvas>
79102
</div>
80103

81104
<!-- Run the game code -->
82-
<script type="text/javascript" src="html5game/collision_triangle.js?LLZAC=2064053786"></script>
105+
<script type="text/javascript" src="html5game/collision_triangle_demo.js?cachebust=603471514"></script>
106+
107+
<!-- Builtin injector for injecting runner path -->
108+
109+
83110
<script>window.onload = GameMaker_Init;</script>
111+
112+
<!-- Builtin injector for injecting google analytics code -->
113+
114+
84115
</body>
85-
</html>
116+
117+
<!-- Custom PostBody code is injected here -->
118+
119+
</html>

‎script/collision_triangle.html‎

Lines changed: 62 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -82,70 +82,72 @@ <h1>collision_triangle</h1>
8282

8383
function collision_triangle(x1, y1, x2, y2, x3, y3, object)
8484
{
85-
// Bounding box check (early out)
86-
var xmin = min(x1, x2, x3);
87-
var xmax = max(x1, x2, x3);
88-
var ymin = min(y1, y2, y3);
89-
var ymax = max(y1, y2, y3);
90-
var inst = collision_rectangle(xmin, ymin, xmax, ymax, object, false, false);
91-
if (inst == noone) return noone;
85+
// Bounding box check (early out)
86+
var xmin = min(x1, x2, x3);
87+
var xmax = max(x1, x2, x3);
88+
var ymin = min(y1, y2, y3);
89+
var ymax = max(y1, y2, y3);
90+
var inst = collision_rectangle(xmin, ymin, xmax, ymax, object, false, false);
91+
if (inst == noone) return noone;
9292

93-
// Triangle perimeter check (early out)
94-
inst = collision_line(x1, y1, x2, y2, object, true, false);
95-
if (inst != noone) return inst;
96-
inst = collision_line(x1, y1, x3, y3, object, true, false);
97-
if (inst != noone) return inst;
98-
inst = collision_line(x2, y2, x3, y3, object, true, false);
99-
if (inst != noone) return inst;
93+
// Triangle perimeter check (early out)
94+
inst = collision_line(x1, y1, x2, y2, object, true, false);
95+
if (inst != noone) return inst;
96+
inst = collision_line(x1, y1, x3, y3, object, true, false);
97+
if (inst != noone) return inst;
98+
inst = collision_line(x2, y2, x3, y3, object, true, false);
99+
if (inst != noone) return inst;
100100

101-
// Find long side, make it (x1,y2) to (x2,y2)
102-
var d12 = point_distance(x1, y1, x2, y2);
103-
var d13 = point_distance(x1, y1, x3, y3);
104-
var d23 = point_distance(x2, y2, x3, y3);
105-
var t;
106-
switch (max(d12, d13, d23)) {
107-
case d13:
108-
t = x2; x2 = x3; x3 = t;
109-
t = y2; y2 = y3; y3 = t;
110-
d12 = d13;
111-
break;
112-
case d23:
113-
t = x1; x1 = x3; x3 = t;
114-
t = y1; y1 = y3; y3 = t;
115-
d12 = d23;
116-
break;
117-
}
101+
// Find long side, make it (x1,y2) to (x2,y2)
102+
var d12 = point_distance(x1, y1, x2, y2);
103+
var d13 = point_distance(x1, y1, x3, y3);
104+
var d23 = point_distance(x2, y2, x3, y3);
105+
var t;
106+
switch (max(d12, d13, d23)) {
107+
case d13:
108+
t = x2; x2 = x3; x3 = t;
109+
t = y2; y2 = y3; y3 = t;
110+
d12 = d13;
111+
break;
112+
case d23:
113+
t = x1; x1 = x3; x3 = t;
114+
t = y1; y1 = y3; y3 = t;
115+
d12 = d23;
116+
break;
117+
}
118118

119-
// From (x3,y3), find nearest point on long side (x4,y4).
120-
var dx = x2 - x1;
121-
var dy = y2 - y1;
122-
var x4, y4;
123-
if ((dx == 0) &amp;&amp; (dy == 0)) {
124-
x4 = x1;
125-
y4 = y1;
126-
}else{
127-
t = ((x3 - x1) * dx + (y3 - y1) * dy) / (d12 * d12);
128-
x4 = x1 + t * dx;
129-
y4 = y1 + t * dy;
130-
}
119+
// From (x3,y3), find nearest point on long side (x4,y4).
120+
var x4, y4;
121+
if (d12 == 0) {
122+
x4 = x1;
123+
y4 = y1;
124+
}else{
125+
var dx = x2 - x1;
126+
var dy = y2 - y1;
127+
var px = x3 - x1;
128+
var py = y3 - y1;
129+
t = (px * dx + py * dy) / (d12 * d12);
130+
x4 = x1 + t * dx;
131+
y4 = y1 + t * dy;
132+
}
131133

132-
// A line constructed from (x3,y3) to (x4,y4) divides
133-
// the original triangle into two right triangles.
134-
// Fit the collision mask into these triangles.
135-
var d14 = point_distance(x1, y1, x4, y4);
136-
var d24 = d12 - d14;
137-
with (__objCollisionTriangle) {
138-
image_angle = point_direction(x1, y1, x4, y4);
139-
image_xscale = d14 / size;
140-
image_yscale = point_distance(x3, y3, x4, y4) / size;
141-
if ((x1 &gt; x4) ^^ (y3 &lt; y4)) image_yscale *= -1;
142-
inst = instance_place(x4, y4, object);
143-
if (inst != noone) return inst;
144-
image_xscale = -d24 / size;
145-
inst = instance_place(x4, y4, object);
146-
if (inst != noone) return inst;
147-
}
148-
return noone;
134+
// A line constructed from (x3,y3) to (x4,y4) divides
135+
// the original triangle into two right triangles.
136+
// Fit the collision mask into these triangles.
137+
var d14 = point_distance(x1, y1, x4, y4);
138+
var d24 = d12 - d14;
139+
var side = sign((x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1));
140+
with (__objCollisionTriangle) {
141+
image_angle = point_direction(x1, y1, x2, y2);
142+
image_xscale = d14 / size;
143+
image_yscale = side * point_distance(x3, y3, x4, y4) / size;
144+
inst = instance_place(x4, y4, object);
145+
if (inst != noone) return inst;
146+
image_xscale = -d24 / size;
147+
inst = instance_place(x4, y4, object);
148+
if (inst != noone) return inst;
149+
}
150+
return noone;
149151
}
150152
</code></pre>
151153
</div>

‎scriptindex.json‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)