Skip to main content
Participant
June 1, 2023
Question

Make a MovieClip dissapear from the stage

  • June 1, 2023
  • 2 replies
  • 279 views

Hello Adobe Community

I am teaching a high school Game Design class and am a total novice with ActionScript code but very familiar with creating graphics and animating them. I need help tweaking a program so that a MovieClip object will disappear when contact is made with another movie clip. 

The game is a racing game and I want to have the "Car" seemingly pick up objects along the track as it completes the course. 

In the Library I have a MovieClip linked as 'Track' that has several layers, a road, finish line, road hazzards and points that the player must pass to stop the timer.  I want to add objects that the player collects and have them removed from the display stack or just have their alpha changed to zero when the car passes them. 

I would imaging I have to add the objects to an Array and then write a function to change their alpha but I have tried a few things and being a total newbie nothing has worked so far. 

I would be eternally grateful for some help or even direction on where I could find training writing this function. 

I have uploaded the existing code for the game, the new Movie Clip object I have called Egg in the library and linked as a class. The vehicle has a instance name car and is in the Track symbol with an instance name gamesprite.

I'm sure what I want to do is possible but currently not within my capabilities. 

Thank you so much for your time if you decide to assist in this matter.

    This topic has been closed for replies.

    2 replies

    kglad
    Community Expert
    Community Expert
    June 1, 2023

    use hitTestObject to determine if the car contacts an object and use removeChild to remove the object from the display.

    JoãoCésar17023019
    Community Expert
    Community Expert
    June 1, 2023

    Hi.

     

    Do you mind sharing a link to the FLA as well even if you have to use placeholder assets?

     

    Regards,

    JC

    Participant
    June 1, 2023

    Yes here is a game I am testing.

    Thank you again!

    kglad
    Community Expert
    Community Expert
    June 1, 2023

    ?