Hey all, I am somewhat new to programming and I have basic start of a video game. I have been working on Adobe Flash Professional CS6 using AS3 and I am still trying to figure some things out here. My main problem is at the moment is getting my animations to work with my button presses and I notice sometimes when I press those buttons they do not work at the moment they're pressed and I know it has something to do with the timers but if I remove the timers the animations over lap each other when buttons are pressed. Here is what I got so far with my code: By the way Jump, Run, & Slide have the exact same code expect for class and function name.
private var stageRef:Stage; private var key:KeyObject; private var JumpTimer:Timer; private var canJump:Boolean = false; private var SlideTimer:Timer; private var canSlide:Boolean = false; private var RunTimer:Timer; private var canRun:Boolean = false; private var jump:Boolean = false; private var gravity:Number = 10; private var jumpPower:Number = 0; private var isJumping:Boolean = false; private var ground:Number = 600;
public function Start(stageRef:Stage) { this.stageRef = stageRef; key = new KeyObject(stageRef);
JumpTimer = new Timer(1000, 1); JumpTimer.addEventListener(TimerEvent.TIMER, jumpTimerHandler, false, 0, true);
SlideTimer = new Timer(1000, 1); SlideTimer.addEventListener(TimerEvent.TIMER, slideTimerHandler, false, 0, true);
RunTimer = new Timer(1000, 1); RunTimer.addEventListener(TimerEvent.TIMER, runTimerHandler, false, 0, true);
Hey, sorry to bother you again but I am trying to add in a start button and I want to change scenes after I click on it. This is the code I have for my button:
Actually never mind I figured it out, lol... I guess I do have another question I noticed when I change scenes I have to click on the game box again to start moving my character is that normal when someone does that?
It has to do with the focus, like if there was a text box that entered the name for high scores you can take control by using focus, but for focusing on the game you use this
Hey, thanks for the help by the way. It sounds like my friends and I are going to convert this all into Unity and work with that more instead of adobe flash.