Forum Topic: Creating A New Movie Clip (help!)

(104 views • 14 replies)

This topic is 1 page long.

<< < > >>
None

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 06:57 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

Well im makin a game what i want is that when my characters touches an item (instance name "point")
Add 10, make the "point" dissapear AND create another point.

onClipEvent (enterFrame) {

if (this.hitTest(_root.spaceship)) {

_root.score.text += 10;
unloadMovie(this);

}

}

Thats the code for adding the score and making it dissapear (right?) but how do i create another "point" in a different `lace


None

zrb

Reply To Post Reply & Quote

Posted at: 11/3/09 07:05 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,539

At 11/3/09 06:57 PM, exzeta wrote: Thats the code for adding the score and making it dissapear (right?)

Eh, don't use unloadMovie, just use removeMovieClip(this).

but how do i create another "point" in a different `lace

Go learn about attachMovie.
OR just move your current coin in a different place.
EX:

onClipEvent (enterFrame) {

if (this.hitTest(_root.spaceship)) {

_root.score.text += 10;
this._x = (put your new x here)
this._y = (put your new y here)
}

}

Attaching a movie with attachMovie is the best solution though.

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 07:11 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

At 11/3/09 07:05 PM, zrb wrote:
Eh, don't use unloadMovie, just use removeMovieClip(this).

Ok i will try that

OR just move your current coin in a different place.
EX:

onClipEvent (enterFrame) {

if (this.hitTest(_root.spaceship)) {

_root.score.text += 10;
this._x = (put your new x here)
this._y = (put your new y here)
}

}

Thanks for the code


None

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 07:15 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

Its glitchy that way ill try attach movie


None

zrb

Reply To Post Reply & Quote

Posted at: 11/3/09 07:17 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,539

At 11/3/09 07:15 PM, exzeta wrote: Its glitchy that way ill try attach movie

Good !
And be sure to use removeMovieClip and not unloadMovie !

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 07:26 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

Ill do but i need to know, why?


None

zrb

Reply To Post Reply & Quote

Posted at: 11/3/09 07:30 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,539

At 11/3/09 07:26 PM, exzeta wrote: Ill do but i need to know, why?

I don't exactly remember why but I know it had something to do with performance.

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 07:37 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

ok.
I got a new problem now when the score adds
it should go like this
10
20
30
40
50
But it goes like this
10
1010
101010

Help please?


None

Greg-SKA

Reply To Post Reply & Quote

Posted at: 11/3/09 07:39 PM

Greg-SKA DARK LEVEL 05

Sign-Up: 08/20/09

Posts: 115

Change Unload Movieclip to Remove Movieclip

BBS Signature

None

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 07:41 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

At 11/3/09 07:39 PM, Greg-SKA wrote: Change Unload Movieclip to Remove Movieclip

Allready did that


None

zrb

Reply To Post Reply & Quote

Posted at: 11/3/09 07:42 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,539

At 11/3/09 07:39 PM, Greg-SKA wrote: Change Unload Movieclip to Remove Movieclip

Already told him that and that doesn't solve his current problem :\

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

zrb

Reply To Post Reply & Quote

Posted at: 11/3/09 07:45 PM

zrb LIGHT LEVEL 11

Sign-Up: 08/08/06

Posts: 4,539

@Exzeta:

Put this on your main frame:

var Score:Number = 0;
function onEnterFrame() {
scores.text = Score
}

And put this on your coin:

if (this.hitTest(_root.spaceship)) {
_root.Score+=10
}

So change your textbox's instance to "scores" and put those codes in the right place :)

School Sux ! || As :Main || As3: Main || Animation: Main || Flash Tutorials ||

BBS Signature

None

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 07:45 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

my code for adding the score is like this

if (this.hitTest(_root.spaceship)) {

_root.score.text +=10;
removeMovieClip(this);

What should i do?


None

Fion

Reply To Post Reply & Quote

Posted at: 11/3/09 08:03 PM

Fion LIGHT LEVEL 34

Sign-Up: 08/21/05

Posts: 2,373

At 11/3/09 07:30 PM, zrb wrote:
At 11/3/09 07:26 PM, exzeta wrote: Ill do but i need to know, why?
I don't exactly remember why but I know it had something to do with performance.

Yeah it does, using unload movie removes the contents of a movieclip and its custom properties but it does not remove the actual movieclip or its basic properties. Hence it can still be referenced and is taking up (only a little bit) of memory.


Elated

exzeta

Reply To Post Reply & Quote

Posted at: 11/3/09 08:44 PM

exzeta EVIL LEVEL 10

Sign-Up: 06/08/09

Posts: 84

Thanks my problems are solved now


All times are Eastern Standard Time (GMT -5) | Current Time: 04:34 AM

<< Back

This topic is 1 page long.

<< < > >>
You need a Grounds Gold Account to post on the NG BBS! If you don't have one, click here to sign up now! It's fast, free, and easy — and opens up tons of great NG features!