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

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

webjumper01.swf

This is the info page for
Flash #41739

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


Text
this site will (soon) contain demos, articles, resources, and source code.
my interests are in realtime physics (and game-dev in general), but
i might also throw in some music or whatever.. who knows.
mare and i are working on a series of tutorials explaining stuff like
collision detection and rigid body simulation, as well as a bit of
character-animation stuff we've been fooling with.
in the meantime, i'll be putting up various demos and other bits to perhaps pique your curiosity...

left/right/down arrows:
flex edges
spacebar: grab/throw
with mouse
(click in the box
to set focus)

ActionScript [AS1/AS2]

Frame 1
function Particle(px, py) { this.px = px; this.py = py; this.ox = px; this.oy = py; } function Stick(a, b, minlen, maxlen) { this.a = a; this.b = b; this.minl = minlen; this.maxl = maxlen; this.curl = maxlen; } function Integrate() { var g = GRAV; var d = DRAG; var p; var d1; var d2; var px; var py; for (var i in pList) { p = pList[i]; d2 = d; d1 = d + 1; px = p.px; py = p.py; p.px = (d1 * px) - (d2 * p.ox); p.py = ((d1 * py) - (d2 * p.oy)) + g; p.ox = px; p.oy = py; } } function Constrain() { var p = pList; var s; var a; var b; var dx; var dy; var dL; var d; var l; for (var i in sList) { s = sList[i]; a = p[s.a]; b = p[s.b]; dx = b.px - a.px; dy = b.py - a.py; dL = Math.sqrt((dx * dx) + (dy * dy)); l = s.curl; d = (dL - l) / dL; dx = dx * d; dy = dy * d; a.px = a.px + (0.5 * dx); a.py = a.py + (0.5 * dy); b.px = b.px - (0.5 * dx); b.py = b.py - (0.5 * dy); } } function Collide() { var p; var x; var y; for (var i in pList) { p = pList[i]; x = p.px; y = p.py; if (XMAX < x) { p.px = XMAX; } else if (x < XMIN) { p.px = XMIN; } if (YMAX < y) { var vy = (p.py - p.oy); p.py = YMAX; var vx = (p.px - p.ox); vx = vx * FRICTION; p.ox = p.px - vx; vy = vy * BOUNCE; p.oy = YMAX + vy; } else if (y < YMIN) { p.py = YMIN; } } } function Input() { if (Key.isDown(32)) { pList[0].px = _xmouse; pList[0].py = _ymouse; } var s; for (var i in sList) { s = sList[i]; if (Key.isDown(keys[i])) { s.curl = s.curl * SHORTENSPEED; if (s.curlen < s.minl) { s.curl = s.minl; } } else { s.curl = s.maxl; } } } keys = new Array(); keys[0] = 37; keys[1] = 40; keys[2] = 39; function Renderer() { this.mc = _root.createEmptyMovieClip("renderoutputMC", 100); } Renderer.prototype.Draw = function () { var p0 = pList[0]; var p1 = pList[1]; var p2 = pList[2]; this.mc.clear(); this.mc.lineStyle(0, 0, 100); this.mc.moveTo(p0.px, p0.py); this.mc.lineTo(p1.px, p1.py); this.mc.lineTo(p2.px, p2.py); this.mc.lineTo(p0.px, p0.py); }; XMIN = 50; XMAX = 650; YMIN = 150; YMAX = 550; FRICTION = 0.8; DRAG = 0.99; GRAV = 0.2; BOUNCE = 0.6; MAXLEN = 85; MINLEN = 50; SHORTENSPEED = 0.9; pList = new Array(); pList.push(new Particle(XMIN, YMIN)); pList.push(new Particle(XMIN, YMIN + MAXLEN)); pList.push(new Particle(XMIN + MAXLEN, YMIN)); sList = new Array(); sList.push(new Stick(0, 1, MINLEN, MAXLEN)); sList.push(new Stick(1, 2, MINLEN, MAXLEN)); sList.push(new Stick(2, 0, MINLEN, MAXLEN)); gfx = new Renderer(); function Tick() { Integrate(); Input(); Constrain(); Collide(); gfx.Draw(); } _root.onEnterFrame = Tick;

Library Items

Symbol 1 GraphicUsed by:Timeline
Symbol 2 FontUsed by:3 4
Symbol 3 TextUses:2Used by:Timeline
Symbol 4 TextUses:2Used by:Timeline




http://swfchan.com/9/41739/info.shtml
Created: 10/5 -2019 05:52:43 Last modified: 10/5 -2019 05:52:43 Server time: 02/05 -2024 04:25:01