View Full Version : trouble with game
07-11-2003, 12:03 PM
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 :D
thanx a lot
07-11-2003, 12:07 PM
it wouldn't let me attach it as fla... so i renamed it to bmp just rename back to fla should work
07-12-2003, 12:43 AM
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?
So we basically just have to guess what blue box the ball is under?
07-12-2003, 12:47 AM
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
07-12-2003, 02:49 AM
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?
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:
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!
07-12-2003, 09:16 AM
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
07-13-2003, 02:24 PM
If you write:
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:
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:
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.
vBulletin® v3.8.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.