dcsimg
A Flash Developer Resource Site

Results 1 to 1 of 1

Thread: [F8] Pushing/Pulling.

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    1

    [F8] Pushing/Pulling.

    Well... I wasn't sure if I should post this in newbie section because I am a noob or in the regular flash help section, I decided to play it safe and go with the former, obviously.

    Anyways I've searched for about an hour and a half, I thought I found a few helpful things but not enough to satisfy my question. Search has failed me ):

    I am making a side scrolling-platform sort of story. I have some questions. I hope nobody minds.

    1) All right -- Uh, first -- I am curious to a "push" and "pull" sort of command. But it's kind of complex. Think Valkyrie Profile for those who have ever played it. Let's say the key to start is "Z". When pressing Z, I want it to check if there is an object that the character can grab onto. If not it just does nothing.
    Now say there is an object. Character presses Z. This will make the Character have the "GrabWait" graphic.

    Code:
    var keyListener:Object = new Object();
    keyListener.onKeyDown = function() {
    	if (Key.getCode() == 90) {
    		// GRABBING ON
    		this.characterMC.gotoAndStop("grabWait");
    	}
    };
    Key.addListener(keyListener);
    The above is only checking if person pressed Z and the character is grabbing on despite checking if an object is in front of him -- so how to do that?

    2) Ok so he's grabbed onto something. I want the Left and Right arrow keys to make him either push or pull. But -- He has to be holding "Z" key all the while, while he holds down left or right arrow to push or pull. If he lets go of Left or right arrow, he will return to "grabWait" graphic. If he lets go of "Z", he will return to regular standing position.

    3) Yeah, and the last bit is -- so if he's pushing/pulling, how do you make the object he is pushing/pulling move?


    Is this too much to ask? Thanks in advance. I am a freaking noob.

    Edit: yeah... and that code is probably wrong |: I don't know how to use that stupid keylistener thing.
    Last edited by sarionel; 04-15-2007 at 10:02 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center