actionscript 3 - Moving Main Character in Mobile Game (as3) -
i'm working on role-playing video game android devices in flash using as3, , i've started program since days, slowly... starting "moving main character" thing first... but, have problem moving main character... it's shown in video i've recorded:
https://drive.google.com/file/d/0b9glofqhm_ferktqa00xamywc0k/view?usp=sharing
as see in video, it's assumed main character move holding arrow button, instead, character moves little , stops when hold down arrow button.
and here comes code used on subject, it's modification , mixture of code snippets i've done myself, of code snippets, tutorials , other postings on website, other codes used on game in future, understand as3 things
here's it:
//up multitouch.inputmode = multitouchinputmode.touch_point; joystick.arriba.addeventlistener(touchevent.touch_begin, fl_pressbeginhandler_2); move.up.addeventlistener(touchevent.touch_end, fl_pressendhandler_2); move.up.addeventlistener(touchevent.touch_out, fl_pressendhandler_2); move.up.addeventlistener(touchevent.touch_roll_out, fl_pressendhandler_2); function fl_pressbeginhandler_2(event:touchevent):void { move.up.gotoandstop(8); char.gotoandstop(473); char.y -=5; } function fl_pressendhandler_2(event:touchevent):void { move.up.gotoandstop(1); char.gotoandstop(23); } //down multitouch.inputmode = multitouchinputmode.touch_point; joystick.abajo.addeventlistener(touchevent.touch_begin, fl_pressbeginhandler_3); move.down.addeventlistener(touchevent.touch_end, fl_pressendhandler_3); move.down.addeventlistener(touchevent.touch_out, fl_pressendhandler_3); move.down.addeventlistener(touchevent.touch_roll_out, fl_pressendhandler_3); function fl_pressbeginhandler_3(event:touchevent):void { move.down.gotoandstop(8); char.gotoandstop(445); char.y += 5; } function fl_pressendhandler_3(event:touchevent):void { move.down.gotoandstop(1); char.gotoandstop(1); } //left multitouch.inputmode = multitouchinputmode.touch_point; move.left.addeventlistener(touchevent.touch_begin, fl_pressbeginhandler_4); move.left.addeventlistener(touchevent.touch_end, fl_pressendhandler_4); move.left.addeventlistener(touchevent.touch_out, fl_pressendhandler_4); move.left.addeventlistener(touchevent.touch_roll_out, fl_pressendhandler_4); function fl_pressbeginhandler_4(event:touchevent):void { move.left.gotoandstop(8); char.gotoandstop(486); char.x -= 5; } function fl_pressendhandler_4(event:touchevent):void { move.left.gotoandstop(1); char.gotoandstop(34); } //derecha multitouch.inputmode = multitouchinputmode.touch_point; move.right.addeventlistener(touchevent.touch_begin, fl_pressbeginhandler_5); move.right.addeventlistener(touchevent.touch_end, fl_pressendhandler_5); move.right.addeventlistener(touchevent.touch_out, fl_pressendhandler_5); move.right.addeventlistener(touchevent.touch_roll_out, fl_pressendhandler_5); function fl_pressbeginhandler_5(event:touchevent):void { move.right.gotoandstop(8); char.gotoandstop(458); char.x += 5; } function fl_pressendhandler_5(event:touchevent):void { move.right.gotoandstop(1); char.gotoandstop(11); } //instance names (all instances shown on video) //move.up - arrow button //move.down - down arrow button //move.left - left arrow button //move.right - right arrow button //move - arrow buttons because used //of way on joystick config (where part of joystick and// //the others can change positions, alpha, size?...) //char - main character //instances have gotoandstop because, command, they're able //change of other forms seen on video. //they have placeholder graphics seen in video, i'll //replace them usable graphics after programming...
with this, can fix problem, please?
thanks.
Comments
Post a Comment