A Flash Developer Resource Site

Page 9 of 9 FirstFirst ... 56789
Results 161 to 174 of 174

Thread: New Group Project

  1. #161
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    I will. Thanx again. I'll take a look into it and I hope I can use it.

    l8rs, I'll need some sleep...

  2. #162
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    yeah,do so,me too,till tomorrow

  3. #163
    Agent de Folie dJide's Avatar
    Join Date
    Jan 2002
    Posts
    361
    I propose we have moving into the next room style scrolling, but the tiles are smaller so that there is more room for action. Otherwise, something about the size of Ed_Mack's thing might work well with keyboard movement, still room by room movement however.

  4. #164
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    http://www.ssj-games.com/flash/iso_engine.swf

    It's not a hitTest() based collision. It still has some problems.
    Code:
    onClipEvent(mouseMove) {
    	point = new object();
    	point.x = _xmouse;
    	point.y = _ymouse;
    	_root.out3 = point.x + " === " + point.y;
    	_root.out = _root._xmouse + " === " + _root._ymouse;
    	localToGlobal(point);
    	_root.out2 = point.x + " === " + point.y;
    	updateAfterEvent();
    }
    That's the example of localToGlobal. I wonder: are the out(2/3) variables needed?

    DJide, you mean we are going back to keyboard movement? Why have I put myself through all this stress then? Collision for keyboard movement is much easier, and I already had a good working one.

  5. #165
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    i´m not for key based movement.
    to jeroen:i don´t get what this should be,tell me for what you want to translate the variables to global ones and i´ll see if i know what to change (why these === ?)
    here´s a translator object
    point = new Object();
    point.x = _root.world.player._x;
    point.y = _root.world.player._y;
    _parent.localToGlobal(point);

    hope this helps,if so
    thanks goes also to blink from whom i learnt how to apply it
    if not,state where to use it with which variables so i can work out a more specific solution


    [Edited by tomsamson on 03-06-2002 at 09:14 AM]

  6. #166
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Yes, I see. That code was the example of the Flash help file, from the Actions Dictionary. I was rather confused by it. But I will just delete those unneeded lines. Saves space.

    Here's the newest version:
    http://www.ssj-games.com/flash/iso_engine.swf

    There is still only one problem. SOMEHOW, it doesn't detect collision when you move from the right to the left into a wall. I double checked the code. I can't find the problem.

  7. #167
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    as i don´t know which code of the ones we talked about you used,i can only suggest you check for the mcs position as it looks like you can only go through the wall if you move towards the lower right side of it,and therefore it might be a placement problem of your cube/wall mc.If not,tell me which of the collision (avoidance) codes you used.

  8. #168
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Ok. Lets see...

    Here's the new swf, right click and choose download so you can open it in Flash to see the Trace functions:
    http://www.ssj-games.com/flash/iso_engine.swf

    The working code for detecting of a wall on the right:
    if (_root.controller.myMap[drows][dcols+1] == 1) {
    tilenr = tileChar+1;
    dir = 5;
    checkHit(_root.man.base._x, _root.man.base._y, dir, tilenr);
    }


    Here's the prototype function:
    Code:
    Movieclip.prototype.checkHit=function(x, y, dir, tile){
    
    	point = new object();
    	point.x = x;
    	point.y = y;
    	localToGlobal(point);
    	if (dir==2){ point.y = point.y-2.3; dirx=0; diry=0.5; }
    	else if (dir==4){ point.x = point.x-5.0; dirx=0.5; diry=0; }
    	else if (dir==5){ point.x = point.x+5.0; dirx=-0.5; diry=0; }
    	else if (dir==7){ point.y = point.y+2.3; dirx=0; diry=-0.5; }
    	else if (dir==1){ point.y = point.y-2.3; dirx=0; diry=0.5; }
    	else if (dir==3){ point.y = point.y-2.3; dirx=0; diry=0.5; }
    	else if (dir==6){ point.y = point.y+2.3; dirx=0; diry=-0.5; }
    	else if (dir==8){ point.y = point.y+2.3; dirx=0; diry=-0.5; }
    
    	if (_root["quad" add tile].tile.hitTest(point.x, point.y, true)) { 
    		trace(">>>>>>>>>>>>>>>>>>>>>>>>>>>> Wall hitted!!"); 
    		vx=dirx; 
    		vy=diry; 
    		cursorX=_x; 
    		cursorY=_y; 
    	}
    }
    And this is the (exact half, top half) working script for detecting a wall on the left:
    if (_root.controller.myMap[drows][dcols-1] == 1) {
    tilenr = tileChar-1;
    dir = 4;
    checkHit(_root.man.base._x, _root.man.base._y, dir, tilenr);
    trace("wall on my left");
    }



    I can't see the problem. Oh to clear some things up, I explain some variables:

    _root.controller.myMap == It's my map array. If it's 1, then there's a wall.
    drows/dcold == The rows/cols that the sphere is IN. For example, the tile on the left of the player would be the same row, but one col less.
    tilenr == the number of the tile that's been checked for. All tiles are named like _root.quadX, where X is the number.
    dir == stands for direction. It makes the prototype function compensate for the difference between the exact _x/_y coordinates of the base of the sphere. If this isn't included, the sphere would always run into the wall for half.
    vx/vy == These are the x and y vectors. These amount are added each onenterframe to the sphere's _x and _y.
    cursorX/cursorY == these variables are originally used to pinpoint the coordinates where you click left to move. If these coordinates are the same as _x/_y of the sphere, vx and vy will be 0, stopping the sphere.

    That's about it.

  9. #169
    Agent de Folie dJide's Avatar
    Join Date
    Jan 2002
    Posts
    361
    Good, the movement seems just about done. I'll design the maps. You are doing it the standard array way right?

  10. #170
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Yup. The Array of my current map is:
    Code:
    	myMap = [ [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1],
    		      [1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1],
    		      [1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1],
    		      [1,0,0,0,0,1,0,1,0,0,0,0,0,1,1,0,0,0,0,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1],
    		      [1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,0,1,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,1],
    		      [1,0,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,1],
    		      [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1],
    		      [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1] ];

  11. #171
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Sheesh.... I am gone for a weekend, and look what's happened.


  12. #172
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    jeroen,i´ve been out too,still that "right side" problem?
    after reading your post on it again,i think i know the solution now.send me the fla and i´ll fix it.

  13. #173
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    I think the problem is somewhere in this code: (I got that thought of the debugging function in flash.

    Code:
    	//calculate rows and cols
    	drows = Math.floor((_y-_root.controller.offz)/_root.controller.h);
    	dbtilenr = drows*_root.controller.cols
    	dcols = Math.floor((_x-_root["quad" add dbtilenr]._x)/_root.controller.w);
    	tileChar = dbtilenr + dcols;

  14. #174
    Junior Member
    Join Date
    Dec 2001
    Posts
    17

    Smile

    hi, it might be too late but can i help in some way? i'm pretty good in swift 3d and have some experiance in 3ds...


    tell me what u think ok???

    -Don

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