00:00
00:00
B1KMusic
Hi. I make games and software. I'm not on NG much, but feel free to peruse my youtube and gitlab for interesting stuff.

Braden @B1KMusic

Age 29, Male

Programmer/Musician/

fish

Earth, Milky Way

Joined on 6/19/11

Level:
10
Exp Points:
948 / 1,110
Exp Rank:
69,504
Vote Power:
5.20 votes
Rank:
Police Sergeant
Global Rank:
8,626
Blams:
42
Saves:
1,040
B/P Bonus:
12%
Whistle:
Normal
Medals:
799

Update on Cam Class

Posted by B1KMusic - July 29th, 2011


You may have noticed that the Damn function Follow can ONLY be used in the movie clip actionscript panel. Well this is a solution!

Here is an entirely new Cam Class

VCam.as

Instructions for usage are inside the file, but the basic basic basics are that the only lines you need to put to create a VCam in Flash AS2 are:

inside of the movieclip:
var CM = new VCam()

in the main actions panel:
var C = cam.CM
onEnterFrame = function(){
C.Follow(cam,char)
}
5 lines, 5 lines instead of a whole shitload of confusing code that is annoying to have to copy/paste every time you need a VCam

Assuming you gave instance names, the camera is 'cam' and the character to follow is 'char'

All script goes inside frames

There are three variables used in the class that can be changed outside of it, allowing intricate things to happen, they are:

Floor, Mouse, and Visible

Floor makes the camera follow the object riding the bottom of the movie, rather than being centered

Mouse makes the camera Follow the mouse

Visible decides whether or not the camera is visible, this one is different, however.

To use Visible, place

VCam.Visible = true
CM = new VCam(this)

These two lines need to be arranged exactly like that, or it won't work

I have no idea why :/

New edit:

You can include ALL the script in the main frame!

Just put:

onEnterFrame = function(){
CAM = new VCam(instance1)
CAM.Follow(instance1,instance2)
}


Comments

great stuff, thanks

fo' sho