A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Build Houses

  1. #1
    Junior Member
    Join Date
    Jun 2010
    Posts
    3

    Build Houses

    Hi Everyone,

    I'm not a proper newbiew to flash as i've had a bit of time messing around creating little projects but I wasn't sure what forum this would be best in :P

    In was just wondering if anyone knows how people can build houses like on neopets.com. I'm just after the bsics of how objects are placed and saved on screen and what order there put in, like how to set teh depth from teh screen eg this object is behind that one.

    Thanks

  2. #2
    Senior Member
    Join Date
    May 2010
    Posts
    178
    Making Graphic of different objects in different inside a movieClips, and mapping with Array, will create Landscape for games.

    Code:
    
    myMap=[ [['a1',1],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0]],
    	[['a1',1],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0]],
    	[['a1',1],['a2',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0]],
    	[['a1',1],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0]],
    	[['a1',1],['a0',0],['a0',0],['a2',0],['a0',0],['a0',0],['a0',0],['a0',0]],
    	[['a1',1],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0]],
    	[['a1',1],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0]],
    	[['a1',1],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0],['a0',0]] ];
    
    
    
    tW=40;
    tH=30;
    
    startX = 250;
    startY = 40;
    
    this.attachMovie("empty", "Clip", 0);
    this.Clip._x = startX;
    this.Clip._y = startY;
    
    Width = myMap[0].length;
    	Height = myMap.length;
    	for ( i=0; i<Height; ++i ) {
    		for ( j=0; j<Width; ++j ) {
    			this.Clip.attachMovie("tile", "t_"+i+"_"+j, ++d);
    			this.Clip["t_"+i+"_"+j]._x = (tW/2)*(j-i);
    			this.Clip["t_"+i+"_"+j]._y = (tH/2)*(j+i);
    			this.Clip["t_"+i+"_"+j].gotoAndStop ( myMap[i][j][0] );
    		}
    	}

    In Library: 2 movieclips --> 1. Emply Movie Clip, Identifier = empty
    2. Graphic Movie Clip Identifier = tile


    Inside Graphic Movie Clip Frame label is as a0,a1,a2,a3 and so on....

    stop(); action in 1st Frame.



    If this hard to understand, let me know.. I will try to describe the method


    Poltuda

  3. #3
    Junior Member
    Join Date
    Jun 2010
    Posts
    3
    Thanks for the reply

    I get it slightly but could you exlpain what the values in the mymap array are?
    and I didn't fully understand this line ( 'Inside Graphic Movie Clip Frame label is as a0,a1,a2,a3 and so on....' ).

    Thanks again

  4. #4
    Senior Member
    Join Date
    May 2010
    Posts
    178

    Isometric Mapping

    This is an example of what you are looking for, if I am right...

    Code:
    myMap=[ [['a0'],['a0'],['a0'],['a0'],['a2'],['a0'],['a0'],['a0']],
                  [['a0'],['a0'],['a0'],['a0'],['a1'],['a0'],['a0'],['a0']],
    	      [['a2'],['a2'],['a0'],['a0'],['a2'],['a2'],['a0'],['a2']],
    	      [['a0'],['a2'],['a2'],['a0'],['a0'],['a0'],['a0'],['a0']],
    	      [['a0'],['a2'],['a1'],['a2'],['a2'],['a2'],['a0'],['a0']],
    	      [['a0'],['a0'],['a0'],['a0'],['a2'],['a1'],['a0'],['a0']],
    	      [['a2'],['a0'],['a0'],['a2'],['a0'],['a0'],['a2'],['a0']],
    	      [['a0'],['a0'],['a2'],['a0'],['a0'],['a0'],['a0'],['a0']]];
    This Array will also work for simple landscaping.

    After you reply I will remove this file

    Best Regards


    Poltuda
    Last edited by poltuda; 06-17-2010 at 11:59 PM.

  5. #5
    Junior Member
    Join Date
    Jun 2010
    Posts
    3
    That's what I'm after.

    So is there anyway to interact with each objects since it was created like that so the user, when playing the swf, can delete etc?

    I get how to delete from the array but how can you identefy lets say (row4 column2) from (row1 column5)?
    Thanks

  6. #6
    Senior Member
    Join Date
    May 2010
    Posts
    178
    "Hittest" or putting a function of each clips for an action will go for this..

    You don't have to delete, instead, just push the Array into other Frame Label.

    Poltuda

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center