Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

platform game-using mouse key

Community Beginner ,
Mar 08, 2017 Mar 08, 2017

hey,

i want to create platform game in as3.

can someone send/write me the code that say: if i press the mouse key the player jump else he stand on the ground.

thanks(-:

TOPICS
ActionScript
180
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 08, 2017 Mar 08, 2017
LATEST

AS3 relies on event listeners for just about everything.  If you want to have something hapen as a result of a mouse interaction then you need to use an event listener for that.

addEventListener(MouseEvent.MOUSE_DOWN, doSomethingDown);

function doSomethingDown(evt:MouseEvent):void {

     // put whatever you plan for jumping code here

}

addEventListener(MouseEvent.MOUSE_UP, doSomethingUp);

function doSomethingUp(evt:MouseEvent):void {

     // put whatever you plan for stopping the jumping here

}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines