Golden Sun Syndicate Forums: Golden Sun Syndicate Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Actionscript (again) Problem 2!

#1   Kuchiyose 

  • Berserker
  • PipPipPipPipPipPip
    • Group: Members
    • Posts: 540
    • Joined: 25-December 07
    • Gender:Male
    • Location:UK
    • Interests:I enjoy watching anime (Naruto, FMA, One Piece, Elfin Lied etc). I also enjoy flash animating. If you want to know me more just send me a message and if you want to add me onto msn just ask (prefer it that way). <br /><br />Of course I'm a gamer, I like mainly Nintendo games but I also like Microsoft and Sony's. My faves are: Golden Sun 1 and 2, Jump Ultimate Star, Naruto class of Ninja, Metroid prime 1, 2 and 3, Legend of Zelda, Bioshock, Medal of Honour etc and so on.

      Posted 20 February 2008 - 10:40 AM

    Ok this time its the characters movements! Geeez there no loveT.T
    Well anyways I want my character to move to: the left, right, up and down. Simple the code for is:
     onClipEvent (enterFrame) {
       
    		 if (Key.isDown(Key.LEFT)) {
       
    			  _x--;
       
    		  }
       
    		  if (Key.isDown(Key.RIGHT)) {
       
    		   _x++;
       
    		  }
       
    		  if (Key.isDown(Key.UP)) {
      
    			  _y--;
      
    		  }
      
    		  if (Key.isDown(Key.DOWN)) {
      
    			  _y++;
      
    		  }
    
    	  }
    This would be the code. However I want my character to change when moving, its basically a sprite, I want it to turn left, as if its looking to the left, when i hold the left key, it walks to the left and if I stop holding the key the character stops moving. This is the code iv got so far: 
    [code]onClipEvent (enterFrame) {
    	if (Key.isDown(Key.LEFT)) {
    		_x--;
    		gotoAndStop(5);
    	}
    	if (Key.isDown(Key.RIGHT)) {
    		_x++;
    		gotoAndStop(6);
    	}
    	if (Key.isDown(Key.UP)) {
    		_y--;
    		gotoAndStop(4);
    	}
    	if (Key.isDown(Key.DOWN)) {
    		_y++;
    		gotoAndStop(3);
    	} else {
    		if (Key.isDown(Key.DOWN)) {
    			_y++;
    		}
    		gotoAndStop(1);
    	}
    }




    This kinda works, if i hold the down key, the sprite moves down with the correct animation and when i let go, it stops moving, however if I click the other keys it goes in the right directions but the sprite doesn't change direction it always looking down.
    So help! Iv tried Adobe flash center but no help:S
    I'm using AS2 coding.

    #2   Max 

    • Administrator
    • PipPipPipPipPipPipPipPip
      • Group: Admin
      • Posts: 1,837
      • Joined: 26-January 04
      • Gender:Male
      • Location:Philadelphia

      Posted 20 February 2008 - 03:51 PM

      You must not have pasted that code right, there is an extra or erroneous bracket in there. Try posting it again using the forum's code tag to preserve formatting (don't use Quick Reply, use the full Add Reply link).

      #3   Kuchiyose 

      • Berserker
      • PipPipPipPipPipPip
        • Group: Members
        • Posts: 540
        • Joined: 25-December 07
        • Gender:Male
        • Location:UK
        • Interests:I enjoy watching anime (Naruto, FMA, One Piece, Elfin Lied etc). I also enjoy flash animating. If you want to know me more just send me a message and if you want to add me onto msn just ask (prefer it that way). <br /><br />Of course I'm a gamer, I like mainly Nintendo games but I also like Microsoft and Sony's. My faves are: Golden Sun 1 and 2, Jump Ultimate Star, Naruto class of Ninja, Metroid prime 1, 2 and 3, Legend of Zelda, Bioshock, Medal of Honour etc and so on.

        Posted 21 February 2008 - 12:38 PM

        There we go XD I think?


        Page 1 of 1
        • You cannot start a new topic
        • You cannot reply to this topic