3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

How to Make a Drag n' Drop Game

How to Make a Drag n\
«
  • cc1.JPG
  • cc5.JPG
  • cc6.JPG
Oh, the drag n' drop game. Those were part of my toddler years, and they were fun. At least, until i found out how to make them. You can make one too! Let's do it.

Stuff you need:

Flash(I'm using CS3, but you can use MX-CS4, any version that supports AS2)
Computer

It'll help if you've seen my [http://other http://www.instructables.com/id/How_to_Make_a_Preloader_in_Flash/?ALLSTEPS] flash tutorial.

This is really simple.

 
Remove these adsRemove these ads by Signing Up
 

Step 1Doing it.

Doing it.
First, make 2 layers. One named "Stick" below, and one named "Objects" on top. Draw a the character you're going to dress up up, I'm using a stick figure. Next, lock the layer. Then, click on the "Objects" layer. Draw the object you'll be dragging onto the stick figure and make it a movie clip. Make sure the registration point is in the center.

Next, press F9 and TYPE this code in the movie clip'sActions box(DON'T copy and paste, you bum. how are you gonna learn the code that way? You'll wish you typed it when i get to complicated stuff):

on(press){
this.startDrag(true);
}
on(release){
this.stopDrag(true);
}

Explanation:

on(press){

When this object is clicked...

this.startDrag(true);

Start to drag it...

}

Closes on handler function.

on(release){

When this object is released...

this.stopDrag(true);

Stop dragging it.

}

Closes on handler function.

You're done, just repeat this several times. Each object you make gets this code.
« Previous StepDownload PDFView All StepsNext Step »
8 comments
Aug 23, 2010. 4:42 AMInferndragon says:
Atleast by adding this... I can make a basic game atleast... Just currently... Making the objects required... I'll even add an image of so far (made everything from scratch on Adobe CS4)
Jun 9, 2010. 10:43 PMSolutionsGuy says:
Thankyou! I have been looking for a simple to make flash project, and your tutorial makes this one beyond easy. Your instructions are well worded and comprehensive, and your notes on what the actionscript was actually doing made it easy for a flash noob like me to understand. I still cant believe how simple it was! Thanks again.
Feb 26, 2010. 3:28 PMWarface21 says:
Thanx this really helped.
Sep 27, 2009. 11:46 AM129 Lost nam says:
Now how do i play the game?
Feb 26, 2010. 3:27 PMWarface21 says:
press ctrl+enter or load the published version.
Feb 21, 2009. 1:04 AMSeifpic says:
Thanks, i'm gonna try that now!
May 16, 2009. 5:13 AMcroutonicus says:
What layer is your custom cursor on?
Feb 21, 2009. 1:33 AMSeifpic says:
I did it but there is a problem. I have a cursor in my flash doc and it's code is: custom_cursor.startDrag("true"); Mouse.hide(); and when I drag the tshirt, the mouse stops going with the cursor. Is there a way I can fix this?

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
15
Followers
13
Author:lawizeg(My site!)
I like to draw, play my guitar, play sports, even though im kinda lazy. I'd like to think that i'm good at a lot of stuff, but you can decide.