A Flash Developer Resource Site

Page 5 of 9 FirstFirst 123456789 LastLast
Results 81 to 100 of 174

Thread: New Group Project

  1. #81
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Ooops, forgot to tell..

    There are some problems with it.

    -If it moves, you can sometimes see that the character doesn't swap depths fast enough. (Note to self: Maybe I should increase framerate?)
    -The other character/sphere can be moved with A, W, S, D. The problem is that I don't know exactly how to interact the two with eachother.

    -Jeroen

  2. #82
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    PrED, I didn't used that. As soon as you click with your mouse, it traces the coordinates from your mouse. Then the sphere keeps moving untill it reaches those coordinates.

    I know there are multiple ways to do it. And yours looks much better. Can ya elaborate(sp?) a little about that?

    tnx

    -jeroen

  3. #83
    w00t PrED32's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    529
    grab the angle between them.

    then do a:
    velx = speed*math.cos(angleBetween+180*Math.PI/180);
    vely = speed*math.sin(angleBetween+180*Math.PI/180);

    then just wait till the clip gets in proximity and snap it.

  4. #84
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Move the second sphere around. That was my original movement type. I changed it into mouse movement.
    You can only move up, up/right, right, down, down/left and left.

    What you're saying wouldn't be practical in an isometric world. Only when your movement is tile-based it would be possible, cause then you could calc the angle between the center of the tile and the sphere.

    If you disagree(hopefully^^), please tell.

    -Jeroen
    [Edited by jeroen84 on 02-26-2002 at 10:44 AM]

  5. #85
    w00t PrED32's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    529
    Well yes you can.

    Isometric world is only a different viewpoint.

    The way every1 here is making it yes. you can only move up/left/up-left.

    But in reality its just a slanted topdown view, and you can move angular top down.. why the hell not isometric (heck my example was isometric).

    Besides, when I think Isometric, I think Diablo/Syndicate, realtime stylee.. not waiting for the char to move one cell at a time =)

    I may be wrong.

  6. #86
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    1. What is this moveToMouse action you keep telling about? Can't find it in the help file.

    2. Hmmm... Now to think of it. Yes, you're right. But how do I grab the angle between the sphere and the mouse coordinates? With cos/sin or is there a actionscript for?

    You give me all sorts of nice ideas...^^

  7. #87
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    pred is right,i don´t like tilemapped iso a lot too.
    It has some positive aspects but the slowdon using bigger maps and the tile per tile movement is really bad compared to normal movement which is only displayed in isoview.I´m working on a flash rts with mcfretn for quite a while now and tested many approaches how to do it (including tilemapped movement and preds angle depending one) but the fastest (for us) was to get the x/y values of the mouse (on click) and move the character there.The frame (moving direction of the unit) in the character mc depends on the x/y value of the mouse comparised to the one of the player at the moment of the click.
    pred,anyone,please correct me if there´s a faster solution

  8. #88
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Originally posted by tomsamson
    ...and the tile per tile...
    I wasn't doing that. I did it on a very weird way. I kept the angles of movement that you use with keyboard movement. That was wrong.

    I will change the movement into 2 vectors. One X and one Y, cause when you move to the top-right, your movement vector excists out of two base-vectors.
    ^../\
    |../
    |./
    |/
    |---->

    I will change it l8r, g2g now.

    -Jeroen

  9. #89
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    PrED, I used your code. But it's totally not working...
    Code:
    	angleRad = Math.atan2 ((_root.cursorY - _y), (_roo.cursorX - _x));
    	angleDeg = angleR / Math.PI/180;
    
    	dx = 4*Math.cos(angleDeg+180*Math.PI/180); 
    	dz = 4*Math.sin(angleDeg+180*Math.PI/180);
    
    	if (Math.abs(_x - _root.cursorX) < 2 )
    	{
    		dx = 0;
    		_x = _root.cursorX;
    	}
    
    	if (Math.abs(_y - _root.cursorY) < 2 )
    	{
    		dz = 0;
    		_y = _root.cursorY;
    	}
    The sphere goes totally the wrong way.

    Can't you give the fla from one of your files?

    l8r

    -Jman
    [Edited by jeroen84 on 02-26-2002 at 03:23 PM]

  10. #90
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Ok, made my own mouse movement. Now I just have to redo the collision engine though...

    o_o;;

    Here it is:
    http://www.ssj-games.com/flash/Mouse_mov.swf

    -Jman

  11. #91
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Ok, integrated the swapdepth engine. Here's the file:

    http://www.ssj-games.com/flash/iso_engine_v2.swf

    I am now gonna work on the collision part.

    But first... I have to get me something to eat. ^^

    -Jman

  12. #92
    w00t PrED32's Avatar
    Join Date
    Sep 2001
    Location
    Sydney, Australia
    Posts
    529
    jeroen, how are you handling the swapDepths?

  13. #93
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    jeroen,i see you´re coming up good and i read in preds thread you have difficulties with the collision detection (and that you don´t want to use hittest),here´s something for you:
    code:--------------------------------------------------------------------------------
    //returns the x and y distances between two movieclips as an object
    //syntax:
    //
    //movieclip1.distance(movieclip2)

    Movieclip.prototype.distance=function(movieclip){
    var temp=new Object()
    temp.distx=_x-movieclip._x
    temp.disty=_y-movieclip._y
    temp.distance=Math.sqrt((temp.distx*temp.distx)+(t emp.disty*temp.disty))
    return temp
    }
    //end of code----------------------------------------------
    //add some action (stop/change of direction)for a certain distance

    "short" note on this:
    i´ve also tested this for multiple (differently named) instances of mcs and it works good as long as you use several instances (with forthrunning numbers) of TWO mcs,but it gets weirdo if you check for more different mcs.
    you can also add a check if the object in a certain distance is an mc or a graphic symbol,so you can make bg objects (trees,rocks etc.) graphic symbols and player/npc characters mcs to add different behaviour when a bg object is in a certain distance than if it´s a npc
    hope this helps

    [Edited by tomsamson on 02-27-2002 at 08:27 AM]

  14. #94
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    PrED:
    Each Tile has its own depth based on the row + it's _x. The sphere calculates in which row it is and adds it's own _x. That's it's depth.

    tomsamson:
    errrrrrrr...? So I should have to check every Tile if it's in neirby the sphere? That's a little too much checks for my taste.

    -Jeroen

  15. #95
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    mine is not tile based,i only have bg objects (all graphic symbols) and player/npc units on stage (all mcs).(and a bg but that´s not in the checked stage).
    So i can see if there´s an object in a certain distance,what it is and how to react on that.It skips to different actionsets depending on if the object in the way is an mc or graphic symbol.i don´t know,it works pretty fast like that
    (and i can´t imagine another collision system solution for non circle objects which doesn´t use hittest right now,anyone,suggestions are welcome)
    [Edited by tomsamson on 02-27-2002 at 08:39 AM]

  16. #96
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    But you DO use that function as many times as you have objects on your screen?

    Need to know that....

    -jeroen

  17. #97
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    the distance check is only executed for a moving player´s unit.if several units are moving to the same direction,the one with the lowest number does the distance check for objects in the way.(mcs are duplicated with forthrunning numbers,as i mentioned above).so the code doesn´t have to be executed on each unit.(slight slowdowns only occur when lots of units (over 40) are moved in various (more than five)directions at once),but again it´s the fastest (and only possible) solution i could imagine without using hittest and tilemapped engine (which is good for that problem but doesn´t allow that big maps))
    [Edited by tomsamson on 02-27-2002 at 09:31 AM]

  18. #98
    Yes we can tomsamson's Avatar
    Join Date
    Sep 2001
    Location
    Team Titan Secret Lair
    Posts
    4,666
    to jeroen:
    i have my free day today,so i´ll come back in an hour or so,right now i´ll go jogging in the forest.
    Hope the mentioned notices were clear enough and helped you,if not just ask,i´ll see what i can do about it when i come back.
    to all others:
    please post them,if you know any other solution for the collision (of non circle objects) which doesn´t use hittest
    up to then,
    tomsamson

  19. #99
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    It's not working.... I can't find the temp object...

    onClipEvent (load) {
    Movieclip.prototype.distance=function(Movieclip){
    var temp = new Object()
    temp.distx = _x-movieclip._x
    temp.disty = _y-movieclip._y
    temp.distance = Math.sqrt((temp.distx*temp.distx)+(temp.disty*temp .disty))
    return temp
    }
    }

    And:
    this.distance(_root["quad" add dbtilenr-21]);

    -Jeroen

  20. #100
    Flash Developer on a break
    Join Date
    Jun 2001
    Location
    The Netherlands
    Posts
    1,370
    Nevermind, I started that script all over again, but with the same principal.(aka using Pythagoras)

    Here's the latest version of the engine. I don't know if I should be happy with the collision's...

    http://www.ssj-games.com/flash/iso_engine_v3.swf

    comments please...

    -Jman

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