A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Ending a Level

  1. #1
    Junior Member
    Join Date
    Mar 2002
    Posts
    27

    Ending a Level

    There are quite a few tutorials on this, but my question wasn't in any of those tutorials. For those of you that have played NinjaGame (NGame). I want to make something similar to how they end each level on there.

    On my game I have a ball, and when it collects the finish 'coin' I want the whole level to stay there, but I don't want the ball to be able to move when it touches the coin.

    If you don't know what I mean then please take a look at NGame:
    http://entertainmentfans.com/ngame/

    When the ninja hits the door then the whole level freezes and he does a little dance. I want this same effect but with a ball hitting a coin (and no dance). Is there a way to restrict movement after the ball hits the coin? I imagine this is a hitTest right? If you don't know what I mean just tell me and I'll try my best to clarify. If it helps I'm using MX and AS2.0

  2. #2
    Senior Member
    Join Date
    Aug 2000
    Location
    Montréal
    Posts
    14,141
    assuming both symbols have the instance names 'ball' and 'coin' and that they are both sitting on the same timeline, this statement should be an example of what you're after:

    Code:
    this.onEnterFrame = function() {
    	if (this.ball.hitTest(this.coin)) {
    		delete this.onEnterFrame;
    	} else {
    		// your moving ball function here
    	}
    };
    gparis

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