PDA

View Full Version : HTH do I make this...



silverneo188
October 26th, 2006, 06:37 AM
how the hech would I make a game like this with flash???Almost all of it

Click here 4 game (http://www.linerider.org/play.php)

Plz help I have looked and tried but nothing worked

Like basicaly I want to
-be able to draw ground in one frame, then be able to select play and it places a movie clip of a ball rolling down what ever your drew, and it rotates depending on it's speed.
-And I also need the screen to move with my ball.
(JUST EXTRA: How would I be able to put different skins in so people can select what type of ball they want?)

If you help I will put ur name in the credits of the game.

You can give me a link to what can help me and I will still put your name in the credits

SacrificialLamb
October 27th, 2006, 03:08 AM
http://www.kirupa.com/forum/showthread.php?t=238708
some queston asked just the other day

silverneo188
October 27th, 2006, 12:08 PM
it doesnt work here is my fla

SacrificialLamb
October 27th, 2006, 03:44 PM
the one on that linked page that i thought would be useful was
http://tonypa.pri.ee/vectors/tut07.html
as you can see in the line game the lines at mostly strait and the drawing thing try’s to make you make them long, so I think they use a method more like the link than a hit test.
I don’t think you should use 2 enterFrame on the same MC, in previous experience the second one cancels the first it’s good practice not to do that

silverneo188
October 27th, 2006, 06:05 PM
soo... what am I supposed to do?

Anogar
October 27th, 2006, 07:58 PM
It's a complex project. If you have to ask, don't try.

SacrificialLamb
October 27th, 2006, 08:33 PM
Will I can’t really dot he whole thing for you. But I have done thins. It draws a of about 50 unit’s that have to be 10 units different in x and y then adds them to an array to be tested for collisions . The collision detecting dose note fully work but it should give you an idea. I do not fully grasp tonypa’s code so it’s not really based on that. But his code works so if you have time I suggest that you read till you understand his code then you should be able to do that.




var ar_pt:Array = new Array();
n = 0;
createEmptyMovieClip("myClip", 1);
myClip.lineStyle(1, 0x000000, 100);
onMouseDown = function () {
myClip.moveTo(_xmouse, _ymouse);
//addes pint to array
ar_pt.push({x:(_xmouse), y:(_ymouse)});
onMouseMove = function () {
di = realDif(_xmouse, _ymouse, ar_pt[n].x, ar_pt[n].y);
if (di>50 && (_xmouse > ar_pt[n].x+10 || _xmouse < ar_pt[n].x-10) && (_ymouse > ar_pt[n].y+10 || _ymouse < ar_pt[n].y-10)) {
myClip.lineTo(_xmouse, _ymouse);
ar_pt.push({x:(_xmouse), y:(_ymouse)});
n++;
}
};
};
onMouseUp = function () {
onMouseMove = null;
};
vel = {x:0, y:0}
gravity = 2;
friction = 0.1;
radeus = 10
cir = drawCircle("circle", radeus, 20, 20, 0x000000, 99, _root);
cir.onEnterFrame = function() {
vel.y += gravity;
vel.y -= friction*vel.y;
vel.x -= friction*vel.x;
test()
this._y += vel.y;
this._x += vel.x;
//while (myClip.hitTest(this._x, this._y, true)) {
//this._y--;
//}
};
test = function () {
for (var i:Number=0; i<(ar_pt.length-1); i++){
traece
pt_o = ar_pt[i]
pt_t = ar_pt[i+1]
dx = pt_o.x - pt_t.x
dy = pt_o.y - pt_t.y
theta = Math.atan2(dy, dx)
dis = realDif(pt_o.x, pt_o.y, _root.circle._x+vel.x , _root.circle._y+vel.y)
of = Math.abs(Math.sin(theta)*dis)
trace(of +" ; "+radeus+" ; "+pt_o.x+" ; "+pt_t.x)
if (of <radeus){
theta+=(Math.PI/2)
vel.x-= Math.cos(theta)*vel.x;
vel.y-= Math.sin(theta)*vel.y;
}

}
}
realDif = function (ix, iy, kx, ky) {
defx = ix-kx;
defy = iy-ky;
//work out distens then reterns it
return (Math.sqrt((defx*defx)+(defy*defy)));
};
function drawCircle(name, r:Number, x:Number, y:Number, col:Number, depth:Number, path:MovieClip) {
//draw the circle
mc = path.createEmptyMovieClip(name, depth);
mc.lineStyle(0, col);
mc.moveTo(x+r, y);
mc.beginFill(col);
gap = 7.2;
for (d=2; d<(50)+1; d += 2) {
ang = (7.2*d)/180*Math.PI;
stes = (7.2*(d-1))/180*Math.PI;
sr = r;
ex = x+Math.cos(ang)*r;
ey = y+Math.sin(ang)*r;
sx = x+Math.cos(stes)*r;
sy = y+Math.sin(stes)*r;
mc.curveTo(sx, sy, ex, ey);
}
endFill();
return (mc);
}

silverneo188
October 27th, 2006, 10:48 PM
Will I can’t really dot he whole thing for you. But I have done thins. It draws a of about 50 unit’s that have to be 10 units different in x and y then adds them to an array to be tested for collisions . The collision detecting dose note fully work but it should give you an idea. I do not fully grasp tonypa’s code so it’s not really based on that. But his code works so if you have time I suggest that you read till you understand his code then you should be able to do that.




var ar_pt:Array = new Array();
n = 0;
createEmptyMovieClip("myClip", 1);
myClip.lineStyle(1, 0x000000, 100);
onMouseDown = function () {
myClip.moveTo(_xmouse, _ymouse);
//addes pint to array
ar_pt.push({x:(_xmouse), y:(_ymouse)});
onMouseMove = function () {
di = realDif(_xmouse, _ymouse, ar_pt[n].x, ar_pt[n].y);
if (di>50 && (_xmouse > ar_pt[n].x+10 || _xmouse < ar_pt[n].x-10) && (_ymouse > ar_pt[n].y+10 || _ymouse < ar_pt[n].y-10)) {
myClip.lineTo(_xmouse, _ymouse);
ar_pt.push({x:(_xmouse), y:(_ymouse)});
n++;
}
};
};
onMouseUp = function () {
onMouseMove = null;
};
vel = {x:0, y:0}
gravity = 2;
friction = 0.1;
radeus = 10
cir = drawCircle("circle", radeus, 20, 20, 0x000000, 99, _root);
cir.onEnterFrame = function() {
vel.y += gravity;
vel.y -= friction*vel.y;
vel.x -= friction*vel.x;
test()
this._y += vel.y;
this._x += vel.x;
//while (myClip.hitTest(this._x, this._y, true)) {
//this._y--;
//}
};
test = function () {
for (var i:Number=0; i<(ar_pt.length-1); i++){
traece
pt_o = ar_pt[i]
pt_t = ar_pt[i+1]
dx = pt_o.x - pt_t.x
dy = pt_o.y - pt_t.y
theta = Math.atan2(dy, dx)
dis = realDif(pt_o.x, pt_o.y, _root.circle._x+vel.x , _root.circle._y+vel.y)
of = Math.abs(Math.sin(theta)*dis)
trace(of +" ; "+radeus+" ; "+pt_o.x+" ; "+pt_t.x)
if (of <radeus){
theta+=(Math.PI/2)
vel.x-= Math.cos(theta)*vel.x;
vel.y-= Math.sin(theta)*vel.y;
}

}
}
realDif = function (ix, iy, kx, ky) {
defx = ix-kx;
defy = iy-ky;
//work out distens then reterns it
return (Math.sqrt((defx*defx)+(defy*defy)));
};
function drawCircle(name, r:Number, x:Number, y:Number, col:Number, depth:Number, path:MovieClip) {
//draw the circle
mc = path.createEmptyMovieClip(name, depth);
mc.lineStyle(0, col);
mc.moveTo(x+r, y);
mc.beginFill(col);
gap = 7.2;
for (d=2; d<(50)+1; d += 2) {
ang = (7.2*d)/180*Math.PI;
stes = (7.2*(d-1))/180*Math.PI;
sr = r;
ex = x+Math.cos(ang)*r;
ey = y+Math.sin(ang)*r;
sx = x+Math.cos(stes)*r;
sy = y+Math.sin(stes)*r;
mc.curveTo(sx, sy, ex, ey);
}
endFill();
return (mc);
}

... doesn't work... the ball just falls through the line I make

SacrificialLamb
October 28th, 2006, 04:19 AM
will "The collision detecting does not fully work" might have been an over statement (and spelt incorrectly) but as I also said in the previous post (with a type-o) “I can’t really do the whole thing for you”. I’m not just going to give you fully working code… do some thing your self

silverneo188
October 29th, 2006, 01:39 AM
fine...
im not good but i'll try