forked from 0ad/0ad
Update to entity data files in preparation for orders sytem
This was SVN commit r784.
This commit is contained in:
parent
194fdf9b4b
commit
939bdae5cb
@ -1,5 +1,5 @@
|
||||
novbo=true
|
||||
shadows=false
|
||||
shadows=true
|
||||
vsync=false
|
||||
|
||||
; You can specify these as well, but the default (keeping the current resolution) is
|
||||
|
@ -5,7 +5,6 @@
|
||||
<Actor>Deciduous 1</Actor>
|
||||
<Speed>0</Speed>
|
||||
<Size Radius="1.0"/>
|
||||
<BoundsOffset x="0.25" y="-1.0" />
|
||||
<EventHandlers>
|
||||
<Initialize>scripts/pasap/initdude</Initialize>
|
||||
<Update>scripts/pasap/tick</Update>
|
||||
|
@ -4,6 +4,6 @@
|
||||
<Name>Deciduous Tree 2</Name>
|
||||
<Actor>Deciduous 2</Actor>
|
||||
<Speed>0</Speed>
|
||||
<BoundsOffset x="0.0" y="-6.25" />
|
||||
<Size Radius="1.5"/>
|
||||
<BoundsOffset x="0.0" y="-15.25" />
|
||||
</Entity>
|
@ -8,4 +8,6 @@
|
||||
<Speed>2.5</Speed>
|
||||
<TurningRadius>2.0</TurningRadius>
|
||||
<Size Radius="0.5" />
|
||||
<Ability>GOTO</Ability>
|
||||
<Ability>PATROL</Ability>
|
||||
</Entity>
|
||||
|
@ -13,6 +13,47 @@
|
||||
writeConsole("Dude created at " + DudeSpawnPoint);
|
||||
}
|
||||
|
||||
function updateOrbital()
|
||||
{
|
||||
if( !getGUIObjectByName( 'arena' ).hidden )
|
||||
{
|
||||
writeConsole( "Updating..." );
|
||||
g_ballx += g_balldx;
|
||||
g_bally += g_balldy;
|
||||
if (g_ballx > 600) {
|
||||
g_balldx *= -0.9;
|
||||
g_ballx = 600-(g_ballx-600);
|
||||
}
|
||||
else if (g_ballx < 0) {
|
||||
g_balldx *= -0.9;
|
||||
g_ballx = -g_ballx;
|
||||
}
|
||||
if (g_bally > 400) {
|
||||
g_balldy *= -0.9;
|
||||
g_bally = 400-(g_bally-400);
|
||||
}
|
||||
else if (g_bally < 0) {
|
||||
g_balldy *= -0.9;
|
||||
g_bally = -g_bally;
|
||||
}
|
||||
|
||||
// Gravitate towards the mouse
|
||||
var vect_x = g_ballx-g_mousex;
|
||||
var vect_y = g_bally-g_mousey;
|
||||
var dsquared = vect_x*vect_x + vect_y*vect_y;
|
||||
if (dsquared < 1000) dsquared = 1000;
|
||||
var force = 10000.0 / dsquared;
|
||||
var mag = Math.sqrt(dsquared);
|
||||
vect_x /= mag; vect_y /= mag;
|
||||
g_balldx -= force * vect_x;
|
||||
g_balldy -= force * vect_y;
|
||||
|
||||
var ball = getGUIObjectByName('ball');
|
||||
var r=5;
|
||||
ball.size = new GUISize(g_ballx-r, g_bally-r, g_ballx+r, g_bally+r);
|
||||
}
|
||||
}
|
||||
|
||||
writeConsole("Made MakeDude " + MakeDude);
|
||||
]]></script>
|
||||
|
||||
@ -62,42 +103,14 @@ Nunc bibendum metus a tellus. Nulla lorem metus, convallis id, lobortis eu, elem
|
||||
g_bally = 200;
|
||||
g_balldx = 0;
|
||||
g_balldy = 0;
|
||||
g_mousex = 0;
|
||||
g_mousey = 0;
|
||||
setInterval( updateOrbital, 100 );
|
||||
]]></action>
|
||||
|
||||
<action on="MouseOver"><![CDATA[
|
||||
g_ballx += g_balldx;
|
||||
g_bally += g_balldy;
|
||||
if (g_ballx > 600) {
|
||||
g_balldx *= -0.9;
|
||||
g_ballx = 600-(g_ballx-600);
|
||||
}
|
||||
else if (g_ballx < 0) {
|
||||
g_balldx *= -0.9;
|
||||
g_ballx = -g_ballx;
|
||||
}
|
||||
if (g_bally > 400) {
|
||||
g_balldy *= -0.9;
|
||||
g_bally = 400-(g_bally-400);
|
||||
}
|
||||
else if (g_bally < 0) {
|
||||
g_balldy *= -0.9;
|
||||
g_bally = -g_bally;
|
||||
}
|
||||
|
||||
// Gravitate towards the mouse
|
||||
var vect_x = g_ballx-mouse.x;
|
||||
var vect_y = g_bally-mouse.y;
|
||||
var dsquared = vect_x*vect_x + vect_y*vect_y;
|
||||
if (dsquared < 1000) dsquared = 1000;
|
||||
var force = 10000.0 / dsquared;
|
||||
var mag = Math.sqrt(dsquared);
|
||||
vect_x /= mag; vect_y /= mag;
|
||||
g_balldx -= force * vect_x;
|
||||
g_balldy -= force * vect_y;
|
||||
|
||||
var ball = getGUIObjectByName('ball');
|
||||
var r=5;
|
||||
ball.size = new GUISize(g_ballx-r, g_bally-r, g_ballx+r, g_bally+r);
|
||||
g_mousex = mouse.x;
|
||||
g_mousey = mouse.y;
|
||||
]]></action>
|
||||
|
||||
</object>
|
||||
|
Loading…
Reference in New Issue
Block a user