Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > General > Gaming and Game Development

Reply
 
Thread Tools Rate Thread Display Modes
Old 01-31-2001, 08:24 PM   #1
Flo
Registered User
 
Join Date: Jan 2001
Location: Los Angeles
Posts: 24
Default

I have this script on a button, what happens is the user drags a little square into a bigger square and then the little square disappers, and it works. What I need help on is now I want to have them be able to drag other little squares onto the bigger square and the bigger square not change (its a game), but I cant figure out the script.

on (press) {
startDrag (this, true);
}

on (release) {
stopDrag ();
if (this._droptarget == "/almostredbox") {
_root._lightgreensquarebutton._visible = 0;
_root.almostredbox._visible = 0;
_root.almostdkredbox._visible = 1;
_root.mandy=_root.mandy+1
}
Flo is offline   Reply With Quote
Old 02-01-2001, 06:47 AM   #2
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

So you have like 5 boxes which you want to drop onto another box and each time you want the smaller one to dissapear? ( Or does the smaller on dissapear only the first time?)
That shouldn't be too hard. You'll need to use relative paths as much as possible to cut down on the scripting.

But first let's address this:
_root._lightgreensquarebutton._visible = 0;
If that code is right you have an element with an underscore as it's first character. I wouldnt' advise that.

Now, this code will make the button you place it on dissapear when it's dropped on the bigger box...

on (press) {
startDrag (this, true);
}

on (release) {
stopDrag ();
if (this._droptarget == "/almostredbox") {
this._visible = 0;
_root.mandy=_root.mandy+1
}

Hope this helps.

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 02-17-2001, 04:47 AM   #3
ene
Registered User
 
Join Date: Feb 2001
Location: Ann Arbor
Posts: 3
Question similar problem need help with game

I am trying to do a similar game in which little squares are dragged in a bigger square. The little squares must be moved into a specific location in the big square because the little squares make up a picture when arranged in the proper order. I need help scripting and I want to make the scene advance to the next phase only if the little squares are all arranged
ene is offline   Reply With Quote
Old 02-17-2001, 06:47 AM   #4
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

By your other post (in tutorial requests) I assume you were talking about one of those slider puzzles. Are you trying to create puzzle where you drag and drop pieces into their positions or one of those slider puzzles where the piece are all jumbled up and you click one piece to slide it horizontally or vertically (these are a lot harder)?

Gimme more info and I'll help out

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Old 02-18-2001, 01:18 PM   #5
ene
Registered User
 
Join Date: Feb 2001
Location: Ann Arbor
Posts: 3
Default help with puzzle game

I'm trying to do one of the puzzles where to image boxes are all jumbled up when the page is loaded. The user just has to drag them back into place. Its not the slider puzzle because the pieces can just be dragged over each other. Artnomad.com is a design group that has a puzzle like it on their site under their portfolio section within the flash work tab

TAHNKYOU for helping
ene is offline   Reply With Quote
Old 02-19-2001, 05:58 AM   #6
Jesse
Administrator
 
Jesse's Avatar
 
Join Date: Nov 2000
Location: Australia
Posts: 8,612
Default

OK, in my experience the best way to make such things is as follows:

Your puzzle is divided roughly into a grid.

|_|_|_|
|_|_|_|
|_|_|_|

Let's say like that, for a 3 x 3 puzzle.

You create an MC whjich has a square, about the size of one grid segment, and then lay out copies of this MC on the stage, alpha faded to 0% (invisble). So you now have 9 copies of this MC on the stage and you should give them instance names in the form of [row,column]. So the top left one would be "11" and the bottom right one would be "33".

Then you break your puzzle down into the same number of piece and make each piece a draggable button (button within an MC). Then you give your MCs instance names corresponding to that of their targets, so the piece of the puzzle which goes in the top lef tcould be called 'piece11' and the piece for the loer right, 'piece33'.

Then, you can use drag and drop and _droptarget checks to see if the piece has been droppe on the right square.
Something like:
on (press) {
startDrag (this, true);
}
on (release) {
stopDrag ();
if (this._droptarget == (substring ( _name, 1, 5 ))) {
// piece has been dropped int he right place
} else {
// piece has NOT been dropped int he right place
}
}

So this takes the name of the square where the user dropped the piece and checks if it corresponds to the number of the piece. If it does, you can add one tot he count of piece correct or something, and if it doesn't the best idea it to move the piece back to where it came from so the user is clear that they've made a mistake.
You may also want to centre pieces if they are correct. I can show you how to do these last two things if you can't figure them out yourself, but for now, have a fiddle and see if this method is for you.

Cheers

Jesse
__________________
Cheers

Jesse Stratford
ActionScript.org Cofounder
Email: presented in this way to stop spam-bots: My email is composed of my first name (jesse) followed by my last name (stratford) followed by @ followed by actionscript.org

Please don't email or PM me Flash questions, that's what the Forums are for!

Please don't rely on me reading my PMs either. Email me about important stuff.
Jesse is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Card Game (turn-based) - Lobby Room and Game Room, maintain state cururu ActionScript 2.0 3 05-20-2006 03:06 AM
Card Match Game, Colour Me In Pictures and Board Game Total Frigging ActionScript 2.0 4 02-21-2005 01:04 AM
[AS2] Store creation in game (else and if question) cdrake Gaming and Game Development 7 09-15-2004 02:45 AM
[AS2] Tile game or not tile game? krolben Gaming and Game Development 4 07-28-2004 01:41 PM


All times are GMT. The time now is 07:45 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.