| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
#1 |
|
..::juSt a gl!tcH;::.
|
I am making a table for a strategy game.
10x10 i got info on the fields (owner, cities, troops, satelites) stored in an array, in the mc with instance name ins_arrays . i got movie clip with instance ins_ispis , with four dynamic fields for displaying info about the field. Now, i need advice. Do I make a 100 mc, tile them on the bg, and attach some code: to check if the mouse is there and if it is. to pass the info to teh display... Is this done with a collision detection or do i search for x and y of the mouse... or can i duplicate 1mc 99 times, equip them with info 'bout the field...wait..then i must after 10th to go to next row...arse.... my brain is wreckin' some advice? if you understod me, that is |
|
|
|
|
|
#2 |
|
..::juSt a gl!tcH;::.
|
*sigh*
|
|
|
|
|
|
|
|
|
#3 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
I don't understand your question. If you duplicate one clip which uses hitTest to check if the _xmouse and _ymouse are on it, you may get what you're after but 100 clip checking if they are being touched every frame is a lot of CPU time and your movie will prolly lag.
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
#4 |
|
..::juSt a gl!tcH;::.
|
Thas's what i think, too. Any advice how and where to store the data about the particular filed on the board?.
If u can't understand me just say so . |
|
|
|
|
|
#5 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
I think the best idea would be to make the squares each a button (within an MC), that way you can add rollOver events to them and not have to loop and use hitTest. Laying them out is very easy... can you do that much yourself?
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
#6 | |
|
..::juSt a gl!tcH;::.
|
Quote:
Uh i am farely new to actionscript, but i want to learn.Realy. There is nothing much in Flash that i dont know, besides as. Sorry if i am bothering ya'll. ![]() |
|
|
|
|
|
|
#7 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
You could use a 'seed clip' and then duplicate it but I would be inclined to use attachMovieClip because it's neater. Here's some code I whipped up. I'm usinga 10px square and attachMovieClip (see the tutorial if you don't know how to use it):
Code:
// AttachMC Grid Layout Code // Jesse Stratford, http://www.actionscripts.org rows = 5; cols = 3; height = 10; width = 10; count = 10; for (var r = 1; r<=rows; r++) { for (var c = 1; c<=cols; c++) { count++; name = 'clip'+r+'_'+c; _root.attachMovie('myClip', name, count); with (_root[name]) { _x = c*width; _y = r*height; } } }
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
|
|
#8 |
|
..::juSt a gl!tcH;::.
|
thx, i will try it later...i didnt look into attachmovie lately. need to refresh memory.
![]() |
|
|
|
|
|
#9 |
|
..::juSt a gl!tcH;::.
|
all right i tilled them but i want them to show at 0,0 position.
From this code they are tiling from 16 both for x & y. I tried with an "if elese" embeded in tiling proces for checking the first one and seting it on 0.0 position. Hmm..then the second one pops on 32.32position. so i guess i need another variable to tile them right. i tried like this but came nowhere: Code:
onClipEvent (load) {
var_rows = 10;
var_cols = 10;
var_height = 16;
var_width = 16;
var_count = 10;
for (var r = 1; r<=var_rows; r++) {
for (var c = 1; c<=var_cols; c++) {
var_count++;
var_name = 'tile'+r+'_'+c;
if ( c = 1 ) {
_root.attachMovie('tile', var_name, var_count);
with (_root[var_name]) {
_x = 0;
_y = 0;
}
else {
_root.attachMovie('tile', var_name, var_count);
with (_root[var_name]) {
_x = c*var_width;
_y = r*var_height;
}
}
}
}
}
}
|
|
|
|
|
|
#10 |
|
Administrator
Join Date: Nov 2000
Location: Australia
Posts: 8,612
|
huh? if you're trying to get it to put an MC on the _y=0 and _x=0 lines then you just need to change both for loops to start at r=0 and c=0 rather than 1.
__________________
Cheers Jesse Stratford ActionScript.org Cofounder Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org Please don't email or PM me Flash questions, that's what the Forums are for! ![]() Please don't rely on me reading my PMs either. Email me about important stuff. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|