First, this site and the tutorials are great, thanks.
I am building a site for school in which i am using keyboard keys to control a character on screen. The character is only viewed from the side, and only moves left and right. In the tutorial, the bug changes direction using _root.bug._rotation = ###; Because it is a side view, the rotation does not suit my needs. (I need the character to flip horizontally when changing directions, not rotate, so it stays upright…)
Anyone able to suggest anything that might help me out? I am a bit of a flash noob, so forgive me if this is an ignorant question.
Thanks!
I made the changes, but now when i test the movie, the character flips back and forth; the movieclip keeps looping. I tried adding a stop, but then the character still will only face one way.
How can i fix it? Thanks a lot.
Hi
i tried adding the other stop, but now it is stuck facing one direction only. I just want to make sure I have done things correctly, so here is what i’ve done:
On the main timeline, i have 1 keyframe, with the button in it. the action for the button is:
}
Inside the button is the movie clip of the character, it has 2 keyframes, one for each direction, and each frame has a stop action on it.
What am i doing wrong? Thanks a lot for helping me, i really appreciate it.
Assuming you are putting this code on a Movie Clip symbol and that it starts off racing the right (facing right in frame 1 and left in frame 2)… this should work (untested)…
The if statements are in there to constrain it to an area. In this case it can’t go past 100px on the right or 10px on the left. It will just stop instead.
[edit] About time I got that thing to show right [/edit]
Ok, I have another somewhat related question, so I thought I’d just add to this post.
Is it possible to use onKeyPress to make button objects work?
For instance, with the littleman .fla, if the character was moved over another button symbol, pressing the space bar on it would play another Scene. (an action placed on the button…)
I’ve been reading a lot, but I haven’t been able to figure out how this could be done. Any Ideas?
if (this._x >= 50 && this._x<=100){
//keypresscode;
}
This code was pulled out of the air. Totally untested, but it should work like… if theobject is between 50 and 100, and you press this key, it should do this…
Not possitive… in theory I suppose it should work :-\
I guess making the onkeypress interact with buttons in order to change scene is not really necessary. I tried adding a gotoAndPlay (“Scene”, 1) after the ‘if’ condition, but that didn’t seem to work for me. (surprise, surprise, hehe.) Anyways, thanks for the quick reply. I’m going to plug away at it a bit more, maybe I’ll find the answer trial and error stylez. If you have any suggestions, that would be sweet.
O ya that tweened.com site was cool. This project is trying to emulate www.kerb.co.uk
(…in a simplified “drawn super crappy, doesn’t even compare at all” kinda way…)
BTW: Never get down on yourself Your skills are always more than what you think.
I don’t have any suggestions right now. There was a guy named flex that used to post in this forum, but he dropped off the face of the earth :-\ He was excellent at game coding and things like this.