1

Action Script 3.0 Help

Rast 8/11/14 3:45 pm
93
So I am new to action script I know some basics but I needed some jump code to add to my platform game and I cannot seem to make it compatable with IOS touch event if you are familiar with action script please tell me the property I need to use on the commented line

import flash.events.TouchEvent

var grav:Number = 10;
var jumping:Boolean = false;
var jumpPow:Number = 0;

stage.addEventListener(TouchEvent.TOUCH_TAP, onTap); // I need to find something to replace onTap (Some I made up trying to replace onKeyDown)
stage.addEventListener(Event.ENTER_FRAME, update);

function onKeyDown(evt:TouchEvent):void
{
if(flash.events.TouchEvent)
{
if(jumping != true)
{
jumpPow = -50;
jumping = true;
}
}
}


function update(evt:Event):void
{
if(jumping)
{
player1.y += jumpPow;
jumpPow += grav;

if(player1.y >= stage.stageHeight)
{
jumping = false;
player1.y = stage.stageHeight;
}
}
}
Posted by
Rast
Level 1 : New Miner
0

  Have something to say?

JoinSign in

Welcome