'Lo to all who their time to read this.
[COLOR=gray]Thanks for your time. ^^[/COLOR]
[COLOR=black]I’ve been working on a little game,[/COLOR]
[COLOR=black]http://media.putfile.com/Game-by-Gerhard[/COLOR]
Yesterday someone commented that I should make the character crouch, because…
“It would be awesome.”
So I figured, “heck, why not? :)”
I started looking the code and came up with the following concept;
///// start code for crouching and horizontal movement /////
[COLOR=green]if (Key.isDown(_root.CROUCHKEY)) {[/COLOR]
//if the player is pushing the crouch key
[COLOR=green]if (_root.mcPLAYER.GROUNDED == true) {[/COLOR]
//if the player is grounded
[COLOR=green]if (_root.mcPLAYER.DIRECTION == “R”) {[/COLOR]
//if the player is facing right
[COLOR=green]_root.mcPLAYER.gotoAndPlay(8);[/COLOR]
//show the player crouching facing right frame
[COLOR=red]//This is where the fun starts (test: making crouch)[/COLOR]
[COLOR=green]if (Key.isDown(_root.RUNRIGHTKEY)) {[/COLOR]
//if the player is trying to move right aswell, he should start crouching
[COLOR=green]_root.mcPLAYER.XMOVEMENT += 0.1;[/COLOR]
//set the player momentup to go right slowly
[COLOR=green]_root.mcPLAYER.gotoAndStop(11);[/COLOR]
//this SHOULD make crouch animation go
[COLOR=green]}[/COLOR]
[COLOR=#ff0000]//This is where the fun ends (test: making crouch)[/COLOR]
[COLOR=green]} else {[/COLOR]
//if the player is facing left
[COLOR=green]_root.mcPLAYER.gotoAndStop(9);[/COLOR]
//show the player crouching facing left frame
[COLOR=green]}[/COLOR]
[COLOR=green]}[/COLOR]
[COLOR=green]} else {[/COLOR]
//if the player isnt crouching
[COLOR=green]if (Key.isDown(_root.RUNRIGHTKEY)) {[/COLOR]
//if the player is trying to move right
[COLOR=green]_root.mcPLAYER.XMOVEMENT += 1;[/COLOR]
//set the player momentup to go right some
[COLOR=green]_root.mcPLAYER.DIRECTION = “R”;[/COLOR]
//make the player face right
[COLOR=green]}[/COLOR]
[COLOR=green]if (Key.isDown(_root.RUNLEFTKEY)) {[/COLOR]
//if the player is trying to move left
[COLOR=green]_root.mcPLAYER.XMOVEMENT -= 1;[/COLOR]
//set the player momentup to go left some
[COLOR=green]_root.mcPLAYER.DIRECTION = “L”;[/COLOR]
//make the player face left
[COLOR=green]}[/COLOR]
[COLOR=green]}[/COLOR]
///// end code for crouching and horizontal movement /////
///// End code that runs every frame /////
It works, sorta.
It does show frame 11, and it’s even moving slowly… BUT it’s lacking it’s animation!
[COLOR=silver]Dramatic theme[/COLOR]
Which made me think of my previous problem:
[COLOR=seagreen]onClipEvent(load){[/COLOR]
[COLOR=seagreen]startTime = getTimer() + 3000;[/COLOR]
[COLOR=seagreen]}[/COLOR]
[COLOR=seagreen]onClipEvent(enterFrame) {[/COLOR]
[COLOR=seagreen]currentTime = startTime - getTimer();[/COLOR]
[COLOR=seagreen]countDownClock = currentTime/1000;[/COLOR]
[COLOR=seagreen]if (currentTime <= 0) {[/COLOR]
[COLOR=seagreen]gotoAndPlay(10);[/COLOR] [COLOR=silver](or _root.mcPLAYER.gotoAndStop(10); )[/COLOR]
[COLOR=seagreen]}[/COLOR]
[COLOR=seagreen]}[/COLOR]
Which made the animation stop, instead of going to the frame 10…
For some reason, my walking code DOES show an animation…
I did put the whole animation in a one frame movieclip, so that couldn’t be it.
[COLOR=silver]Could it…?[/COLOR]
In any case, help would be appreciated like woa…
[COLOR=gray]Because this is getting a real downer… x.x;[/COLOR]