Forums → Programming Forum → Anyone Wanna Help me improve my code?
So I am a newb at flash and you guys seem reasonably nice (compared to some other places)
So I was wandering if you were willing to help. I appreciate the help of anyone but to the experienced programmers - please don't laugh if my code looks stupid.
Anyway thanks for reading.
- 23 Replies
Any specific question?
Yea I do have one.
In a point and click game what is the best way to speak to characters? I have thought about adding another frame in the character and a bunch of movie clip buttons but I don't really like this idea.
Then maybe just a uniform dialogue movie clip (a blank square) that attaches to the scene when you click a character and fills up with dialogue. Then it unloads once you are done. This method seems like it could get messy when coding. I was thinking maybe an array to store dialogues of the different characters, another array to store the unique button labels (like hello) for each character. But maybe its over complicated?
I think the first method is just better because it's the simple solution, but something tells me that both these ideas are bad.
I don't like the first idea because imagine all the movie clips you'll need. It seems like a waste.
Kind of hard to get a picture of what you need -- got any screenshots?
A point and click game could be a few things. Is it a static screen with things to click on like Myst? Or is it more like Monkey Island where you click and your character moves?
I think both solutions sound okay. Do what is easy and easy to maintain (and doesn't hurt performance).
You can't improve on nothing.... also coding is very tedious you can try doing this
Remember 1 frame 1 action layer as noted here
Insert a new layer labeled dialogue. Create the talking bubble or square, create 2 if you have another person talking.
Then click on the keyframe and highlight it, modify>convert to symbol.
Converting the keyframe to a symbol (and don't forget to name the instance) instead of the object itself makes it a separate video to play within the main (root) timeline.
At this point you can control the conversation
trace("Mouse clicked mouseClick1"
Then you can keep control of the conversation by adding an additional layer on the newly created symbol and giving a label name like "hello" and "bye"
there may be a better way to do this but this one works for me
links above will break at any time...
sorry if my previous post seems too aggressive no offense intended, it was actually longer and I edited it to make less reading
What I prefer most, is a class injecting a semi transparent frame on top of the display list, holding the text you want. You can have properties about the alpha amount, the font to be used, the window size of the frame etc. Now, whenever you need the dialogue displayed you just call the show method of the class, passing the resource id (if you have all the dialogs in an XML) or the text itself.
@ boppins - just a black box on the screen with the same 3 dialogue buttons (which change labels depending on who you click)
@weirdlike - that seems closer to my first solution
@strouthas - i know nothing about classes
have you tried this, I used arial as the font
var format:TextFormat = new TextFormat();
var myFont:Font = new Arial ();
format.font = myFont.fontName;
message_txt.defaultTextFormat = format;
message_txt.text = "You awake from sleeping...";
message_txt.text = "you feel sick";
message_txt.text = "erhaps too much to drink...";
same demo link as above click refresh page
new fla example here
Oh are you using AS3? Im still in the dark ages with AS2
var format:TextFormat = new TextFormat();
format.font = "Arial";
label.text = "You awake from sleeping...";
label.text = "you feel sick";
label.text = "erhaps too much to drink...";
Also.. Whenever I pick up an object it unloads the movie clip (that was the object)
When I go back to the original scene that object comes back.
To counter this I decided to have all my scenes on one frame, and move the whole scene by about 500px when I click an arrow to go somewhere else. I realized that this could hurt performance?
Do you think when I pick an object, I can push values into an array. Depending on what values the array contains, it removes the object from the scene, and each time I go back to a frame it checks all the values and removes objects accordingly.
additional frames are kinda not good but you can try this
on the first frame add
var box:Boolean = true;
on the 2nd frame (or whichever) check if it is true
//true function here
box.visible = false;
don't forget to add the trigger that makes it false so the box is hidden the second time around and the var is on the first frame so it only gets changed through actionscript
also this is 3.0 sorry but it might help a little
no worries, i understand what your saying
yea i thought about that idea, but then you need to add a variable for each item. might get a bit cluttered right?
I suppose so, if you wanted one visible and the another invisible you would need a separate variable for it to work, you can also check to see if it is false so if you wanted one visible while the other is invisible and vise versa
You must be logged in to post a reply!