[web] Big problem with XML and ActionScript 2.0 Game development
Hello. I have a big problem. I have a mousecapture movieclip and xml attributes.x and attributes.y coordinates. I want to display randomly in every 7 seconds an attributes.item name and when clicked on the _root["box"+i].mcraadius add attributes.points to the score.
The clicked point must give a points only when the attributes.item is equal to it.
Also if do not click on the right point he gets minus score from the distance sqrt(a)+sqrt(b) = sqrt(c)
attributes.item is town name and points are points displayed in xml file i have no clue how to connect them.
I need :
random item in 7 seconds
connect item name with points
distance from the mcraadius ( if the distance is farer it will be bigger minus points )
Can anyone help me please?
Code:
_root.mousecapture.onRelease = function(){
viga = -2;
}
swfArray = new Array();
var kaart_xml = new XML();
kaart_xml.ignoreWhite = true;
kaart_xml.onLoad = function(success)
{
if (success)
{
var kaart = this.firstChild;
Speed = kaart.attributes.speed;
gametime = kaart.attributes.gametime;
NUMOFPICS = kaart.childNodes.length;
for (var i = 0; i<NUMOFPICS; i++)
{
swfArray.push(kaart.childNodes.attributes.item);
mc.duplicateMovieClip("box"+i, i);
_root["box"+i]._x = (Math.floor(kaart.childNodes.attributes.x)+15)-(kaart.childNodes.attributes.raadius/2);
_root["box"+i]._y = (Math.floor(kaart.childNodes.attributes.y)+15)-(kaart.childNodes.attributes.raadius/2);
_root["box"+i].mcraadius._width = kaart.childNodes.attributes.raadius;
_root["box"+i].mcraadius._height = kaart.childNodes.attributes.raadius;
//_root["box"+i].textfield.text = kaart.childNodes.attributes.item;
X = (Math.floor(kaart.childNodes.attributes.x)+15)-(kaart.childNodes.attributes.raadius/2);
Y = (Math.floor(kaart.childNodes.attributes.y)+15)-(kaart.childNodes.attributes.raadius/2);
v = Math.sqrt(X)+Math.sqrt(Y);
scored = Math.floor(kaart.childNodes.attributes.points);
score.text = 0;
_root["box"+i].mcraadius.onPress = function() {
if (swfArray[timerarray]) {score.text = (Math.floor(score.text)+scored);}
}
}
}
}
kaart_xml.load("linnad.xml");
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement