Introduction: How to Make a Drag N' Drop Game

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 https://www.instructables.com/id/How_to_Make_a_Preloader_in_Flash/?ALLSTEPS] flash tutorial.

This is really simple.

Step 1: 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.

Step 2: Done!

Nice job, you just made a game! Comment, rate, and tell me about any problems you have.

Comments

author
stephenlawson69 (author)2017-07-16

Hi, What is CS3? Where can I get it? What is MX-CS4? where can I get it?

What is AS4 how do I know if my computer supports it?

author
Inferndragon (author)2010-08-23

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)

Drag'n'drop - Inferndragon's game.jpg
author
SolutionsGuy (author)2010-06-09

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.

author
Warface21 (author)2010-02-26

Thanx this really helped.

author
129 Lost nam (author)2009-09-27

Now how do i play the game?

author
Warface21 (author)129 Lost nam2010-02-26

press ctrl+enter or load the published version.

author
Seifpic (author)2009-02-21

Thanks, i'm gonna try that now!

author
croutonicus (author)Seifpic2009-05-16

What layer is your custom cursor on?

author
Seifpic (author)2009-02-21

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?

About This Instructable

11,821views

8favorites

License:

Bio: 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 ... More »
More by lawizeg:How to AddHow to Make a Drag n' Drop GameHow to Make a Preloader in Flash
Add instructable to: