00:00
00:00
I-smel
Hey look man, my name's "I-smel". What I lack in smarts, I at least pay back in honesty. Boink!

Tom Brien @I-smel

Age 32, Male

England, MAN-CHESTer

Joined on 3/2/06

Level:
1
Exp Points:
10 / 20
Exp Rank:
> 100,000
Vote Power:
1.50 votes
Rank:
Civilian
Global Rank:
> 100,000
Blams:
0
Saves:
17
B/P Bonus:
0%
Whistle:
Normal
Trophies:
12
Medals:
473
Supporter:
11m 29d
Gear:
2

ray casting

Posted by I-smel - October 27th, 2009


I saw this thing ages ago n I was like waaaaaaht and I just did it.

Ok so like- years n years ago I was watching the first couple trailers for Gish; that game about the tar guy who like goes hard n stuff. At first I thought it was a Flash game, but it had all this 2D light and shadow stuff where I was like WHAT THE FUCK YOU CANT DO THAT. HOW- WHAT- FUCKIN- HOW DO I DO THAT? but then I decided it's not a Flash game and you can't do that in Flash. And if you could then I couldn't really get my head around it at the time.
But I thought about it, and you probably can. I just faffed about for a few minutes and I KIND OF DID?
Yeah I'm gonna say I did.

SHOCK

OOOOOOOOOOOMG oh shit now I should make a game about this.
Except its stupidly over-intensive, so it can never be used in an actual game. and it's kind of messy.

Anyway I just started LEVEL 7 of Legend of JOHNNY which is the LAST LEVEL. I don't work at Smashmouth Games anymore (reffer the last couple pages) so now I've got time to actually make games. JOHNNY's comin up oh my fuck.

That's it.
I bought World of Goo for $5.

ray casting


Comments

LAWL its impenetrable!

That looks like preety complicated coding, but if you wanted to apply shadow effects why not simply put it inside of the animation? Hand draw the shadows and all that stuff. That raytracing would be for light though wouldnt it. Interesting there. You coder you.

Well anyway Im up for voice acting this baby. So just let me know if you want me to scream into a mic or something again. :)

I get a mic soon Ill try out

nobody actually try that yet. You'll all know when I want voice actors cos Ill be like- sayin it.

very niice!

Duuuuuuuuuuude!
How did you manage to do this? Is it AS 2 or 3? If its 3, could you tell me, how to make the same in AS2?

It's AS2. I don't know AS3.
Ok so I made the ground out of pink squares, made it a movieclip with the instance name "ground".
Then drew the white circle as a light, made it a movieclip with the instance name "CENTRE".
and made the background black.
on CENTRE, I wrote this:

onClipEvent (enterFrame) {
_x = _root._xmouse;
_y = _root._ymouse;
}

to make it follow the mouse.
on the actual frame 1 of the file, I wrote this- not straight away though, it took a load of trial n error:

SPACING = 5;
// SPACING is the distance between each i node
onEnterFrame = function () {
_root.createEmptyMovieClip("LIGHT ", 0);
_root["LIGHT"].moveTo(_root.CENTR E._x, _root.CENTRE._y);
_root["LIGHT"].beginFill(0xFFFFFF , 50);
//These first few lines create a new movieclip that'll be the light.
for (z=0; z<=360; z += 3) {
// check for ground in 360 degrees around the CENTRE- one every 3 degrees
for (i=0; i<30; i++) {
// every 3 degrees, do 30 checks that stretch out from the CENTRE
Xnode = _root.CENTRE._x+(i*SPACING)*Math.
cos(z*(Math.PI/180));
Ynode = _root.CENTRE._y+(i*SPACING)*Math.
sin(z*(Math.PI/180));
if (!_root.ground.hitTest(Xnode, Ynode, true)) {
//create a node wherever empty space hits the ground
_root["HITPOINTX"+z] = Xnode;
_root["HITPOINTY"+z] = Ynode;
} else {
break;
//if the light's touching the ground, then stop
}
}
_root["LIGHT"].lineTo(_root["HITP OINTX"+z], _root["HITPOINTY"+z]);
// do a dot-to-dot around all the nodes, creating the light shape.
}
_root["LIGHT"].endFill();
};

and thats it. I wouldnt reccomend it if youre new to actionscript.
Also remember- it probably cant be used in an actual game cos itd ruin the framerate.

I heard somewhere that you could do this. It looks really cool although it is a bit messy.
If it's ok can you send me an .fla (for learning purposes, will rewrite script not just use yours), or at least give me some hints as to how you did it.

reffer to above

Sweet! Is that manipulating the graphics class in AS3? Slick job on the non-smooth edges where the light collides with the level. :D

its the graphics API in AS2. and thanks!

Man that method is using a shotgun to kill a fly, but even so I like your thinking around a problem.
Also learn some AS3, you could do cycles like that without affecting the framerate in the slightest :D

thatd take so much time Id have to stop making games

and "using a shotgun to kill a fly" is a great phrase

So, I worked a little and...KINDA DID IT TOO.

Check this shit out!
<a href="http://www.swfcabin.com/open/1256878937">http://www.swfcabin.com/open/12568789 37</a>

It's not finished yet, though.

oh yea, drawing the shadow also almost works.

Do you have any idea when Legend of JOHNNY is comin out?

this year? hopefully?
Im doin the final boss now, then Ive got cutscenes to do. In past games I've neglected cutscenes, just doin slideshows instead, but this time I'm goin all the way.