-
03-05-2002, 06:59 PM
#161
Flash Developer on a break
I will. Thanx again. I'll take a look into it and I hope I can use it.
l8rs, I'll need some sleep...
-
03-05-2002, 07:59 PM
#162
Yes we can
yeah,do so,me too,till tomorrow
-
03-05-2002, 09:40 PM
#163
Agent de Folie
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.
-
03-06-2002, 04:35 AM
#164
Flash Developer on a break
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.
-
03-06-2002, 10:07 AM
#165
Yes we can
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]
-
03-06-2002, 11:03 AM
#166
Flash Developer on a break
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.
-
03-06-2002, 12:05 PM
#167
Yes we can
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.
-
03-06-2002, 02:40 PM
#168
Flash Developer on a break
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.
-
03-06-2002, 07:42 PM
#169
Agent de Folie
Good, the movement seems just about done. I'll design the maps. You are doing it the standard array way right?
-
03-07-2002, 02:17 PM
#170
Flash Developer on a break
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] ];
-
03-11-2002, 05:14 AM
#171
Flash Developer on a break
Sheesh.... I am gone for a weekend, and look what's happened.
-
03-11-2002, 11:02 AM
#172
Yes we can
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.
-
03-11-2002, 05:40 PM
#173
Flash Developer on a break
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;
-
03-12-2002, 06:37 PM
#174
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|