Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=======================================
- // FRAME 1
- //=======================================
- stop();
- Multitouch.inputMode = MultitouchInputMode.TOUCH_POINT;
- menuplay.addEventListener(TouchEvent.TOUCH_TAP, playgame);
- function playgame(event: TouchEvent): void {
- gotoAndStop(2);
- }
- //=======================================
- // FRAME 2
- //=======================================
- stop();
- menus.visible = false;
- backgame.visible = false;
- var lompat = false;
- var loncat = 30;
- var gravitasi = 6;
- var batasAtas = 350;
- var playerScore: int = 0;
- var game_paused: Boolean = false;
- pauseBT.addEventListener(TouchEvent.TOUCH_TAP, pause_menu);
- home.addEventListener(TouchEvent.TOUCH_TAP, home_menu);
- backgame.addEventListener(TouchEvent.TOUCH_TAP, remove_pause);
- tombol.addEventListener(TouchEvent.TOUCH_TAP, fl_TapHandler_4);
- addEventListener(Event.ENTER_FRAME, loop);
- function pause_menu(event: TouchEvent): void {
- trace("btname:", event.target.name);
- menus.visible = true;
- backgame.visible = true;
- pauseBT.visible = false;
- game_paused = true;
- player.stop();
- }
- function remove_pause(event: TouchEvent): void {
- trace("btname:", event.target.name);
- menus.visible = false;
- backgame.visible = false;
- game_paused = false;
- pauseBT.visible = true;
- player.play();
- }
- function home_menu(event: TouchEvent): void {
- trace("btname:", event.target.name);
- removeEventListener(Event.ENTER_FRAME, loop);
- gotoAndStop(1);
- }
- function fl_TapHandler_4(event: TouchEvent) {
- trace("btname:", event.target.name);
- trace("testignaifwa")
- lompat = true;
- }
- function loop(event: Event): void {
- if (!game_paused) {
- if (lompat) {
- player.y -= loncat;
- loncat -= gravitasi;
- if (player.y > batasAtas) {
- lompat = false;
- loncat = 30;
- }
- }
- a.x -= 10;
- if (player.hitTestObject(a) == true) {
- playerScore += 10;
- updateTextFields();
- }
- } else {
- trace("game paused!");
- }
- }
- function updateTextFields(): void {
- playerScoreText.text = ("SCORE :" + playerScore);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement