| Welcome to Brackenwood. We hope you enjoy your visit. You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free. Join our community! If you're already a member please log in to your account to access all of our features: |
| Character Movement | |
|---|---|
| Tweet Topic Started: Jul 31 2005, 06:52 PM (999 Views) | |
| Andros | Jul 31 2005, 06:52 PM Post #1 |
|
Check my location.
|
What script would get a character to move in eight directions with a separate animation for each? If eight is impossible, then four. |
![]() |
|
| Vector | Jul 31 2005, 09:49 PM Post #2 |
|
Resident Actionscript Guru ♂
![]()
|
Step 1: create your movieclip for your player, call it iPlayer. Step 2: Make 5 frames (or change to your liking) for walking in each direction, and 5 frames at the very end. The frames need to be in this order (at the moment):
Step 3: Put this code on your main frame:
Step 4: It's aliveeeeeeeeeee!!!!! If you've got any specific questions just hollar! :lol: <edit> An alternative would be to have one frame for each direction in the player movieclip, and movieclips within those frames, which lets you have different length cycles.
|
![]() |
|
| chluaid | Jul 31 2005, 10:13 PM Post #3 |
![]()
Bitey's Daddy
![]()
|
awesome! Now make him jump
|
![]() |
|
| Rubberhead | Aug 1 2005, 02:07 AM Post #4 |
|
Fatscat Kittycat
![]()
|
Whoa, the script sucks, but damn! That has to be the best animation ever!
|
![]() |
|
| TheEYE | Aug 1 2005, 02:58 AM Post #5 |
![]()
Lurys Fey Daemyt
![]()
|
:lol: I hear that! Vec man, quit wasting your and our time with your crappy AS man... you totally suck you jive turkey! Stick to what you truly excel at... that sweet frame by frame you do man!
|
![]() |
|
| mayshing | Aug 1 2005, 10:48 PM Post #6 |
|
Brackenwood Newbie
|
O_o man i would like to see the result of this method. |
![]() |
|
| Mr. Jiggmin | Aug 2 2005, 05:59 AM Post #7 |
|
made of tulips
|
You really should make a game out of that, and draw everything else with that same level of awesomeness!
|
![]() |
|
| Vector | Aug 2 2005, 08:45 AM Post #8 |
|
Resident Actionscript Guru ♂
![]()
|
O_o No need for everyone to be so sarcastic...
|
![]() |
|
| Kalle | Aug 2 2005, 09:40 AM Post #9 |
|
Nemus
|
We all love you man.
What the hell would my mySQL database be without you man!
|
![]() |
|
| Andros | Aug 2 2005, 06:07 PM Post #10 |
|
Check my location.
|
Funny thing is, that animation isn't far off. Has anybody heard of the Kingdom of Loathing? Upon first look, it's reaaaaaaaaallllllly bad, but it in actuality is incredible and delightful. The witty humor and constant random allusions make it one of the better games I've played in a while. I want to make a Flash-based fan game, so expect many questions in the future. |
![]() |
|
| boundless | Aug 3 2005, 06:16 AM Post #11 |
|
stuck in the third dimension
|
I can't get this to work! I made the iPlayer movie clip with 45 keyframes with each set of 5 for the movements. I clicked on the main frame and pasted that code. What did I do wrong? |
![]() |
|
| mystical-mongoose | Aug 3 2005, 01:27 PM Post #12 |
![]()
Eggy Toast
|
How would I change this so that there are only 4 movements and one of them is jumping? |
![]() |
|
| Vector | Aug 3 2005, 01:51 PM Post #13 |
|
Resident Actionscript Guru ♂
![]()
|
Here's the source file for this project... have a look, it should help you figure it out a bit more. Directions Source File as for your question mongoose, i'll edit this post when i've finished typing <edit> The following code is for 4 DIRECTIONS ONLY
|
![]() |
|
| Mr. Jiggmin | Aug 3 2005, 02:10 PM Post #14 |
|
made of tulips
|
Allrighty vec, I've never seen an increment then start over thingy coded this way...
Huh? I'm guessing the <5 ? is like an if statment..... and the iPlayer.vPhase+1 is the increment...... and the :1 is what it goes back to???
|
![]() |
|
| Vector | Aug 3 2005, 02:17 PM Post #15 |
|
Resident Actionscript Guru ♂
![]()
|
Yeah this thing is really handy... variable = (condition) ? (if condition is true) : (if condition = false); For example, iPlayer.vPhase = (iPlayer.vPhase) < 5 ? iPlayer.vPhase + 1 : 1; is saying if (iPlayer.vPhase) < 5, then set iPlayer.vPhase to iPlayer.vPhase + 1. Otherwise, set it to 1. |
![]() |
|
| Mr. Jiggmin | Aug 3 2005, 03:58 PM Post #16 |
|
made of tulips
|
oooohhh that's handy. Thanks! |
![]() |
|
| boundless | Aug 3 2005, 05:11 PM Post #17 |
|
stuck in the third dimension
|
Is that download for mx 2004? I only have mx
|
![]() |
|
| Vector | Aug 3 2005, 07:13 PM Post #18 |
|
Resident Actionscript Guru ♂
![]()
|
Yeah, it is for 2004... If you want to run this code in MX i think you would need to change
to
That's the only thing I can see off hand... Here boundless, I saved a FlashMX copy for you
|
![]() |
|
| boundless | Aug 4 2005, 04:57 AM Post #19 |
|
stuck in the third dimension
|
Thanks Vector!
Oh I didn't know about that stop(); inside the movieclip.
|
![]() |
|
| Andros | Mar 4 2006, 03:27 PM Post #20 |
|
Check my location.
|
In the long time since I made this topic, the idea has evolved a lot. I've got here what I've accomplished concerning basic quad-directional movement. However, I want to know how to make him jump. I figured that I just needed to copy the code and change the button to SPACE and the location to the animation's frames, but that didn't work. Also, I want to make it so that he can jump while holding UP or DOWN in the corresponding directions. Check here for the swf. EDIT: Boy, am I stupid. I didn't even NOTICE the topic on the main page called "Character Jump." However, it doesn't help me. How do I establish the ground and gravity? I don't just want a 2D platform either--how would I establish the ground in a way similar to the Simpsons original arcade game and Paper Mario? |
![]() |
|
| Andros | Mar 6 2006, 07:21 AM Post #21 |
|
Check my location.
|
Come on! I know I shouldn't bump, but it's been a whole weekend and I haven't been able to continue work on my game. |
![]() |
|
| Mr. Jiggmin | Mar 6 2006, 12:34 PM Post #22 |
|
made of tulips
|
Nuts. Vector took his example down. I so wanted to see it again...
Andros - in a game like yours, the ground is wherever you happen to be standing when you begin to jump. If your character is at (300, 200), then store the y location in a variable when they jump. Then reference that variable to see where the ground is, and if your character is touching it. Other than that, it's the same concept as the jump code in the other topic. I swiped this from the other topic and made a few changes to show you the gist of what I'm saying:
That'll only work if you stand in place and jump. If you want to move while you jump, then you'll have to add the x and y distance to both the character in the air, and add the y distance to yGround. |
![]() |
|
| Andros | Mar 7 2006, 11:36 AM Post #23 |
|
Check my location.
|
Uh, where would I go about putting that code? It doesn't work on the stage or in the movieclip. |
![]() |
|
| Andros | Mar 14 2006, 10:29 AM Post #24 |
|
Check my location.
|
I'm really lost on this one. I'm trying to get as far as I can on this thing with as little help, but I'm truly stumped. I looked through the code you gave me... where does it actually define jumping? It doesn't work. At least now I figured out how to make it give me no errors... anyway... how would I go about defining jumping? Plus, I have no idea how to selectively change the code for midair and on-ground. I've really got a mediocre understanding of Actionscript--I'm used to simple stuff on my graphing calculator. In other words, my knowledge is in conditional statements, variables, setting labels and locations to return to later, etc. If you could maybe help me in a way catered to that, perhaps I'd do better. |
![]() |
|
| smoscar_01 | Mar 17 2006, 02:08 AM Post #25 |
|
Mid-Level ActionScripter
|
check your inbox youd receive a message with my info contact me and Ill happily help you
|
![]() |
|
| 1 user reading this topic (1 Guest and 0 Anonymous) | |
| « Previous Topic · Actionscript · Next Topic » |











5:11 AM Jul 12