Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 07-11-2003, 11:03 AM   #1
smoke10010
Member
 
Join Date: Jul 2003
Posts: 80
Default trouble with game

the game is real simple.. I'm having problems with the setpropert it won't line up properly.

The idea is you click start and then the ball will choose a random number from 0 to 19. 20 buttons appear and the ball is hidden. clicking a button returns a number 0 to 19 depending on the button and compares the values if you got it right you win if not click again. my main problem is getting the ball to line up properly with the buttons and there are a bunch of bugs i haven't figured out. but if you guys can tell me why it won't line up i'm set. I'm also sure there's a better way to do this if you guys could help with that I wouldn't mind


thanx a lot
smoke10010 is offline   Reply With Quote
Old 07-11-2003, 11:07 AM   #2
smoke10010
Member
 
Join Date: Jul 2003
Posts: 80
Default it didn't attach

it wouldn't let me attach it as fla... so i renamed it to bmp just rename back to fla should work
Attached Images
File Type: bmp findball.bmp (65.5 KB, 117 views)
smoke10010 is offline   Reply With Quote
Old 07-11-2003, 11:43 PM   #3
red penguin
[^\d\D]
 
red penguin's Avatar
 
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,254
Default

Good god, man....a function for each number??? Do you not see a pattern there at all? Don;t you think that could be written as ONE function?

Phew...

So we basically just have to guess what blue box the ball is under?
__________________

komielan.com
red penguin is offline   Reply With Quote
Old 07-11-2003, 11:47 PM   #4
smoke10010
Member
 
Join Date: Jul 2003
Posts: 80
Default

yeah basically that's it.. i do see the pattern but i'm horribly confused by the whole timeline situation and when variables exist and where and even how to pass them back and forth sometimes... needless to say i need more work with actionscript but like i said the timeline thing throws me off... there's code all over the place it's a mess i know... needless to say i'm a newbie hehe
smoke10010 is offline   Reply With Quote
Old 07-12-2003, 01:49 AM   #5
red penguin
[^\d\D]
 
red penguin's Avatar
 
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,254
Default

Okie, nOOb, here ya go:

I was flabbergasted at what I saw so I decided to REALLY lend a learning hand here. Hey...I was a nOOb once too...

Take a look at the file and, well, READ CODE and COMMENTS.

One function to set the position. To hide is basically to simply take a random # so that's what the hideball function does. Picks a random # and passes it to our set position function! Guess what! The names of the boxes? Yup. Just use #'s! Simple, right?

And for them there boxes, why drag 20 clips from the library when ya can easily make a grid with code? And name 'em in the process as well as give them a function for clicking on them? Dynamic is FUN!

Sounds like a lot but it's not really. Read. Learn. Have fun.

Timelines. All the references are really for the _root. But I never really say '_root', do I?
ActionScript Code:
setPos=function(name){     this.mov_ball._x=this[name]._x;     this.mov_ball._y=this[name]._y;     this.mov_ball.str_name=name; };
Nope. I am using 'this' to reference 'this' timeline. It just so happens that the timeline we are on is in fact the _root! One reference in there is:
ActionScript Code:
this._parent.mov_to_target;
See if you can figure out exactly what I'm talking about there. (Hint: where is this line of code? So then what is 'this' (in this case) a reference to?)

Good luck and code on!
Attached Files
File Type: zip hide_ball.zip (3.5 KB, 132 views)
__________________

komielan.com
red penguin is offline   Reply With Quote
Old 07-12-2003, 08:16 AM   #6
smoke10010
Member
 
Join Date: Jul 2003
Posts: 80
Default

thanx a lot... i actually had no idea the this.whatever existed and did everything through _root.
and i didn't actually know u could give non-buttons click commands... anyway thanx for all the help i'll keep playing around with it.. if you ever come back to this post one more question. when i have variables in a timeline and i want to pass it back and forth within the timeline can i pass a variable on to a movie clip or something ahead of where the total movie is playing or can i only pass the variable after the movie has loaded the clip?

i dunno if that made any sense but if it did it'd be nice if you could answer hehe

thanx

- Alex
smoke10010 is offline   Reply With Quote
Old 07-13-2003, 01:24 PM   #7
red penguin
[^\d\D]
 
red penguin's Avatar
 
Join Date: Jun 2001
Location: Brooklyn, NY
Posts: 3,254
Default

If you write:
ActionScript Code:
this.my_variable="foobar";
on the _root, that is where the variable lives, so to speak. THen in a movie clip on frame 5 of your file where you have a movieclip named 'my_clip', you write:
ActionScript Code:
this.my_clip.my_variable=this.my_variable;
You are assigning the _root variable (my_variable) to the movie clip variable of the same name. So in essence you would have two variable of the same name that reside on different timelines. Pathing. Paths. Varibale scope.

Then in the timeline of this clip, you write:
ActionScript Code:
this.str_output="This string resides on the movie clip named "+this._name;
Of course, in that clip you would have a textField named 'str_output'.

Dunno what else to say. Tutes help. Play around with variables. Like I said, variable scope. Learn how to contrl them and pass (assign) variables from different timelines, learn pathing. VERY mportant.

Goodluck.
__________________

komielan.com
red penguin 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


All times are GMT. The time now is 11:28 AM.

///
Follow actionscriptorg on Twitter

 


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