Skip to main content
Participant
June 13, 2014
Question

Drag&Drop Kids Game in AS3 - New at Flash!

  • June 13, 2014
  • 3 replies
  • 1206 views

Hello everyone!

I'm developing a really simple game for kids under 5/6 about colors, and I have some questions.

I already have all visual of the game done, and all the movie clips and items created, but I'm a new user of Flash and I would like to get my work done until June 2nd, because it's part of my course.

Basically, I want to learn how to do a simple drag and drop game using Action Script 3.0. There are total 10 levels with the same "basics" of the game, and the objective is complete a puzzle with one of the options below (Fig. 1).

I have a small amount of code, and I have only the drag action functioning. So, I'll ask you some questions. (Hope you don't get me wrong with this topic. I don't want you to work for me, at all!! I just want to learn and understand how Flash works and do the things by myself. Please, don't get me wrong with this topic!)

- Comparing (maybe with "if") the position of two different movie clips;

For instance, I want to compare a movie clip which is one of the pieces with other movie clip which is a transparent rectangle in the place. After this, I must update the points variable and jump to the frame of the next level.

- Get a variable for the "points" in the upper left corner;

How can I create a points counter?

- "Call" the points variable in the end of the game;

How can I do this? (Fig. 2).

- In the end of this, I should integrate some sounds. For instance, I can try to play a sound when the level starts;

I recorded, in Portuguese, the colors to get them in this game. Is this hard to do?

Thank you so much for your time (and, of course, for your help!).

This topic has been closed for replies.

3 replies

Participant
July 3, 2014

Ok, my job's finally done!!

I've managed way to solve all of the problems I had and add more features, such as a 2 seconds wait after the correct answer given and a "loop points system".

If you need anything of this project, e-mail me or send me a PM with what you need.

Participant
June 20, 2014

I manage a way to solve part of my questions.

I already have all sounds working, and the drag action working and everything's seems right. I've tryied almost 10 different codes and my searches leading to nothing about how to get a "points variable" working on and "drop target" thing, with "gotoAndStop(frame_I_want - Next Level). Right now, on this, I just have the jigsaw pieces with drag action working and a transparent square on target site. I already tryied to write some codes to make my square the "dropTarget", but or I get errors, or simply don't work.

How should I work with this question? A variable for "points" and another variable for "nextLevel" (even knowing that I'll only want to be there when the jigsaw piece is in the same position as my "square dropTarget")?

Thank you for everything anyway!

Much appreciated.

Ned Murphy
Legend
June 13, 2014

It sounds like you need to find a tutorial to help you thru a basic drag and drop scheme.  Try searching Google using terms like "AS3 drag drop tutorial" and you will find plenty of folks have already prepared something for you to learn from.

As far as tracking points go, all you need to do is create a numeric variable and adjust its value each time a drop is correctly or incorrectly made.  

If you want to compare a dropped object to whatever it is dropped on to determine if points should be awarded you should look into the dropTarget property, which tells you which object something was dropped on.

As far as adding sound.  Look into the Sound class so that you can control when a sound plays and which sound it is.

Participant
June 15, 2014

Thanks for the reply.

I'll try to work on it today. I must say that Flash is a really great dev. tool, but it's not that easy to learn, or even "newbie friendly". On the other end, there are plenty of tutorials and methods to learn from, so the information is not bad on the internet.

Thanks once again.

(After I end it, maybe I can share with you the final version (the game is in Portuguese, but I want to do a good work and have a good Drag and Drop game base.)