As2 Basics: Vcam, Rolling physics and much more!

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
2,398
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Jan 21, 2010

Latest tutorial, talkin' 'bout Rolling physics and vCam, along with some other little basics. Here's the link if you wanna play the engine: http://spamtheweb.com/ul/upload/210110/55903_roll.php

Vcam link: http://bryanheisey.com/blog/?page_id=19

Actionscript:

Dude:
onClipEvent (load) {
var Rotation:Number = 0;
}
onClipEvent (enterFrame) {
this._rotation += Rotation;
this._x += Rotation;
if (Key.isDown(Key.LEFT)) {
Rotation -= 1;
}
if (Key.isDown(Key.RIGHT)) {
Rotation += 1;
}
if (!Key.isDown(Key.RIGHT) and (!Key.isDown(Key.LEFT) and (Rotation-"fewer than" symbol-0))) {
Rotation += 0.25;
}
if (!Key.isDown(Key.RIGHT) and (!Key.isDown(Key.LEFT) and (Rotation-"greater than" symbol-0))) {
Rotation -= 0.25;
}
}

Shadow code:

onClipEvent (enterFrame) {
this._x = _root.dude._x;
}

vCam code:

onClipEvent (enterFrame) {
this._x = _root.dude._x;
this._y = _root.dude._y;
}

Buy my T-shirts and other merch at
http://www.cafepress.com/hellapengzilla

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (roojames)

  • How do you make the ball roll along a ground and, more importantly, up/down a hill?

  • @Bikkits This is a lot harder of a thing to do than you probably expect - if you're trying to have grounds at different levels you're better off trying to combine the code from this tutorial with that of a traditional platformer tutorial. As for hill physics, that's really advanced stuff. I can make a hill engine, but it'd be very hard to teach it as my tutorials are generally aimed at beginners.

  • Hi I don't know if you do this anymore, but I would like to know if there is some way to have like a wall stoping the speed and rotation like a wall would.

  • @zitroooz Sorry for the 3 part answer (damn character-count), but if that was too complicated for you, I'm about to make a tutorial about it.

see all

All Comments (21)

Sign In or Sign Up now to post a comment!
  • i have a question..how can you put a word in v-cam?

  • Thanks dude

  • @roojames Okay so...

    I've copied code from two sources now but from either one when the ball touches the ground it starts bouncing like crazy.

    Code: /watch?v=BCPwTIsSVSw

    Also, thew ball falls through all the platforms but the first one it lands on.

    Damn... this is harder than I ever thought it would be.

  • Great tutorial for beginners, but sorry, i already knew how to do this. In fact, I want to put a gravity in so it doesn't bounce upon hitting the ground... but mine still vibrates. I would love some help- alex

  • @HueyF003 a'ight send me all of your code via a private message and I'll see what I can do

  • @roojames Im STOMPED man, i can't figure out what im doing wrong, do you think you can send me a code, or i can send you the code for my character and you can use your more experienced eye to see if you can spot the error, if you have time of course? I would REALLY appreciate it.

  • @roojames I found a way by trying some stuff.. took a while but I got it done. :)

  • @roojames thx for responding man, yea i kno about the instance name, my characters instance name is "player" so i normally just change it in your code, i looked at your character animation tutorial to get my character to move, but you didn't add a jump or gravity so i got that from another tutorial, maybe the two different codes are throwing things off, what do u think, because i am stumped right now :(

    SN: I'll check for curlies, hopefully it's something that simple

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more