View Full Version : Advanced Character Movement ?
Creative_Brain
September 11th, 2006, 01:20 PM
hello good people of kirupa ! :ch:
i'm making a game that will be released in 2007 :beer:
named "Zorn" (rpg game):cons:
anyway it's not just some simple rpg :cyborg:
in normal game you can make the PC walk in four sprites:+)
(up right left down)
so the code goes like this :
onClipEvent (load) {
speed = #
}
onClipEvent (enterFrame) {
if Key.isDown(Key.*key code*)
this._x -= speed (for example)
gotoAndStop (#)
}
and repeat it four times for each key.
so what is my problem ? :red:
well my character is not four sprited it's EIGHT sprited !:puzzle:
so i tried every thing i can but nothing is working:upset: :huh:
PLLEEEASSSE !!!:d: Help !
Joppe
September 11th, 2006, 01:42 PM
try like
if(Key.isDown(Key.UP)&&Key.isDown(Key.LEFT)){
gotoAndStop(upleft)
}
and for other buttons :)
Creative_Brain
September 11th, 2006, 03:49 PM
:tired: sorry already tried that. the character just stands still when i press two buttons :hair:
Creative_Brain
September 11th, 2006, 03:50 PM
i think i should post this in the action script forums maybe ? :look:
DangerousDan
September 11th, 2006, 07:12 PM
Did you have upleft defined when you used joppe's code?
LittleFenris
September 11th, 2006, 07:25 PM
:tired: sorry already tried that. the character just stands still when i press two buttons :hair:
Here is partial code from my project (this movement works):
else if (Key.isDown(Key.LEFT) && Key.isDown(Key.UP)) {
characterDirection = "upleft";
this._y -= speed;
this._x -= speed;
}
I, of course, have this same setup for all 8 directions. The "characterDirection variable is to tell the character movieclip what frame to be on so he will look like he's facing the right way while going in that direction. You can see here (http://www.littlefenris.com/v2/) by the arrows that the character movieclip is going to the right frame and he's moving the right direction as well.
Creative_Brain
September 11th, 2006, 07:56 PM
of course, i'm not that newbie ;) [Dangerous Dan]
Creative_Brain
September 11th, 2006, 08:03 PM
thanks [Little Fenris] :) but i think that will only work on still/no animation clips :bu: , if i want to walk/stop animation i think it will get a little trickey :ko: , well i will try and let you know ;)
thanks. :D
Creative_Brain
September 11th, 2006, 08:27 PM
well i tried it out (i hope that's the way you ment:crazy: ) and...no luck !:ne:
what i'm doing wrong ?:*(
(yes i know it's not moving it's not ment to do so)
here i have included my test:sleep: (converted from flash 8 to flash 6)
thanks.:smirk:
LittleFenris
September 11th, 2006, 09:58 PM
thanks [Little Fenris] :) but i think that will only work on still/no animation clips :bu: , if i want to walk/stop animation i think it will get a little trickey :ko: , well i will try and let you know ;)
thanks. :D
Trust me, that will work with embeded animated movieclips in those frames as well, I just don't have the character animated for testing purposes just to get the character movement and all down first.
I'll take a look at your file and see if I can help.
LittleFenris
September 11th, 2006, 10:06 PM
Here, I redid the file and it works. I would get used to putting all your code on the first frame instead of on movieclips. It makes changing things much easier in the future.
Joppe
September 12th, 2006, 06:06 AM
The problem was, you had the upright in the lowest of the else if statements, all upright upleft downright and downleft must be before the up right down left!
Creative_Brain
September 12th, 2006, 07:07 AM
OOOH !!!! THANKS O GREAT ONES ! :krazy: :krazy: :krazy: :krazy:
i won't forget your help as long as i live ! :D :crying:
[Little Fenris] & [joppe]
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.