STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229593
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/77310121?noj=FRM77310121-21DC" width="1" height="1"></div>

car_v2.swf

This is the info page for
Flash #19634

(Click the ID number above for more basic data on this flash file.)


Text
By Supa Monky

Generate

Distance:

Hill Width:

Random Height:

Car Physics Engine V2

ActionScript [AS1/AS2]

Frame 1
grav = 0.2; car = new Object(); car.spd = 0.2; car.max_spd = 10; car.acc = 0; car.yv = 0; car.xv = 0; car.w_rad = 15; car.w_frc = 0.98; car.fric = 0.99; car.w_dis = 53; car.w_cir = (2 * car.w_rad) * Math.PI; w1.spd = 0; w1.xv = 0; w1.yv = 0; w1.slope = 0; w2.spd = 0; w2.xv = 0; w2.yv = 0; w2.slope = 0; w1.x = w1._x; w2.x = w2._x; frame.swapDepths(2); track_dis = 10000; track_int = 200; vects = track_dis / track_int; g_height = 340; g_rand = 50; flag.swapDepths(_root.getNextHighestDepth()); sflag.swapDepths(_root.getNextHighestDepth()); xs = 0; alpha = (Math.PI/180); generate_terrain = function () { old_height = (g_height + random(g_rand)) - random(g_rand); i = 0; while (i < vects) { rand_h = (g_height + random(g_rand)) - random(g_rand); this["v" + i] = {p0:{x:i * track_int, y:old_height}, p1:{x:(i + 1) * track_int, y:rand_h}}; old_height = rand_h; i++; } this["v" + (vects - 3)].p1.y = this["v" + (vects - 3)].p0.y - 20; this["v" + (vects - 2)].p0.y = this["v" + (vects - 3)].p1.y; this["v" + (vects - 2)].p1.y = this["v" + (vects - 2)].p0.y - 40; this["v" + (vects - 1)].p0.y = this["v" + (vects - 2)].p1.y; this["v" + (vects - 1)].p1.y = this["v" + (vects - 1)].p0.y - 60; fv = this["v" + (vects - 3)]; flag._rotation = Math.atan2(fv.p1.y - fv.p0.y, fv.p1.x - fv.p0.x) / (Math.PI/180); flag.x = fv.p0.x; slag.x = v2.p0.x; }; draw_ground = function () { line = _root.createEmptyMovieClip("line", 1); line.lineStyle(1, 0, 100); line.beginFill(6710886, 100); if (vector_mn < 0) { vector_mn = 0; line.moveTo(v0.p0.x - xs, 400); } if (vector_mx >= vects) { vector_mx = vects - 1; } line.moveTo(this["v" + vector_mn].p0.x - xs, 400); i = vector_mn; while (i <= vector_mx) { v = this["v" + i]; line.lineTo(v.p0.x - xs, v.p0.y); line.lineTo(v.p1.x - xs, v.p1.y); i++; } line.lineTo(this["v" + vector_mx].p1.x - xs, 400); line.endFill(); flag._y = fv.p0.y; slag._y = v2.p0.y; }; onMouseDown = function () { drag_vect = Math.round((xs + _root._xmouse) / track_int); if (Math.abs(this["v" + drag_vect].p1.y - this["v" + (drag_vect + 1)].p0.y) < 100) { if (_root._xmouse <= ((this["v" + drag_vect].p0.x - xs) + (track_int / 2))) { this["v" + drag_vect].p0.y = _root._ymouse; this["v" + (drag_vect - 1)].p1.y = _root._ymouse; } else { this["v" + drag_vect].p1.y = _root._ymouse; this["v" + (drag_vect + 1)].p0.y = _root._ymouse; } } }; generate_terrain(); onEnterFrame = function () { per_done = Math.round((xs / track_dis) * 100); if ((per_done <= 100) && (per_done >= 0)) { track_per = ("Completed: " + per_done) + "%"; } else if (per_done > 100) { track_per = "Completed: 100%"; } else { track_per = "Completed: 0%"; } if (Key.isDown(37)) { car.acc = (-car.spd) / 2; } else if (Key.isDown(39)) { car.acc = car.spd; } else { car.acc = 0; } if (w1.spd > car.max_spd) { w1.spd = car.max_spd; w2.spd = car.max_spd; } if (w1.spd < (-(car.max_spd / 2))) { w1.spd = -(car.max_spd / 2); w2.spd = -(car.max_spd / 2); } j = 1; while (j <= 2) { ob = this["w" + j]; ob.ground = 0; vector_mn = Math.floor(xs / track_int); vector_mx = Math.round((xs + 550) / track_int); i = vector_mn; while (i <= vector_mx) { v = this["v" + i]; vx = (v.p1.x - xs) - (v.p0.x - xs); vy = v.p1.y - v.p0.y; slope = vy / vx; xd = ob.x - (v.p0.x - xs); ground = v.p0.y + (xd * slope); if (((((ob._y + car.w_rad) + ob.yv) >= ground) && (ob.x >= (v.p0.x - xs))) && (ob.x < (v.p1.x - xs))) { ob.ground = 1; ob._y = ground - car.w_rad; w1.spd = w1.spd + ((slope / 5) * car.fric); w2.spd = w1.spd; w1.vx = vx; w1.vy = vy; } i++; } ob.spd = ob.spd + car.acc; if (ob.ground) { ob.dir = Math.atan2(w1.vy, w1.vx) / alpha; ob.xv = ob.spd * Math.cos(ob.dir * alpha); ob.yv = ob.spd * Math.sin(ob.dir * alpha); ob.spd = ob.spd * car.w_frc; } xs = xs + ob.xv; ob.yv = ob.yv + grav; ob._y = ob._y + ob.yv; ob._rotation = ob._rotation + ((ob.spd / car.w_cir) * 360); j++; } body.ro = Math.atan2(w2._y - w1._y, w2._x - w1._x); body._rotation = body.ro / alpha; w_xd = w2._x - w1._x; w_yd = w2._y - w1._y; w_dis = Math.sqrt((w_xd * w_xd) + (w_yd * w_yd)); w2._x = w1._x + (Math.cos(body._rotation * alpha) * car.w_dis); w2._y = w1._y + (Math.sin(body._rotation * alpha) * car.w_dis); body._x = w1._x; body._y = w1._y; draw_ground(); flag._x = flag.x - xs; slag._x = slag.x - xs; };
Symbol 12 Button
on (release) { vects = track_dis / track_int; generate_terrain(); xs = 0; w1.spd = (w2.spd = 0); w1.xv = (w2.xv = 0); }

Library Items

Symbol 1 GraphicUsed by:2
Symbol 2 MovieClipUses:1Used by:Timeline
Symbol 3 FontUsed by:4 7 11 13 14 15 16 17 18 19
Symbol 4 TextUses:3Used by:Timeline
Symbol 5 GraphicUsed by:6
Symbol 6 MovieClipUses:5Used by:Timeline
Symbol 7 EditableTextUses:3Used by:Timeline
Symbol 8 GraphicUsed by:9
Symbol 9 MovieClipUses:8Used by:Timeline
Symbol 10 GraphicUsed by:12
Symbol 11 TextUses:3Used by:12
Symbol 12 ButtonUses:10 11Used by:Timeline
Symbol 13 TextUses:3Used by:Timeline
Symbol 14 EditableTextUses:3Used by:Timeline
Symbol 15 TextUses:3Used by:Timeline
Symbol 16 EditableTextUses:3Used by:Timeline
Symbol 17 TextUses:3Used by:Timeline
Symbol 18 EditableTextUses:3Used by:Timeline
Symbol 19 TextUses:3Used by:Timeline
Symbol 20 GraphicUsed by:21
Symbol 21 MovieClipUses:20Used by:Timeline

Instance Names

"body"Frame 1Symbol 2 MovieClip
"flag"Frame 1Symbol 6 MovieClip
"w1"Frame 1Symbol 9 MovieClip
"w2"Frame 1Symbol 9 MovieClip
"slag"Frame 1Symbol 6 MovieClip
"frame"Frame 1Symbol 21 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access local files only, Metadata not present, AS1/AS2.

Dynamic Text Variables

track_perSymbol 7 EditableText""
track_disSymbol 14 EditableText""
track_intSymbol 16 EditableText""
g_randSymbol 18 EditableText""




http://swfchan.com/4/19634/info.shtml
Created: 29/5 -2019 19:27:29 Last modified: 29/5 -2019 19:27:29 Server time: 21/12 -2024 18:10:39