Smiley with actionscript.
April 21st, 2007 by awesty
This took alot longer for me to do than I thought it would. Just open up flash, click the link below and paste all the code onto the frame. (You will need Flash 8 or MX 2004
If you test your movie (Ctrl+Enter) You should see a smiley face
Filed under My Work, Open Source Code















omg! first comment!
*sigh*
Hi Awesty,
I was wondering if you could email me the codes on how to make it that if ur guy picks up like 7 items it takes him to a new frame??? could you please email me or tell me the codes or code. Thanks
Well first I would have to see the code you are using to pick up the items, then I could help you.
Thats the thing i dont know how to… all i have at the moment is a guy with actionscrip tha allows him to move up, down, left an right. Also ive drawn the items but they havnt got any code. Think you can help?
hello? are you there awesty?
Yea… I was actually asleep when you posted that, so give me more than 40 minutes to answer.
Try this tutorial for the items:
http://www.awestyproductions.c.....pe-game-2/
I e-mailed you for some help, but i think you didnt get it or something, i don’t know what’s wrong with my code (it’s the code that goes in a brick and checks if the ball hits it):
onClipEvent (enterFrame) {
if (_root.ball_mc.hitTest(this._x, this._y-(this._height/2), true)) {
if (_root.bally0) {
_root.bally = -(_root.bally);
}
}
if (_root.ball_mc.hitTest(this._x-(this._width/2), this._y, true)) {
if (_root.ballx>0) {
_root.ballx = -(_root.ballx);
}
}
if (_root.ball_mc.hitTest(this._x+(_width/2), this._y, true)) {
if (_root.bally
Well the second if statement doesn’t make much sense. _root.bally0 can’t end up being either true or false.
Also, _root.bally = -(_root.bally) should be _root.bally =-(_root.bally). And all that is saying is that bally should subtract itself from itself, which again doesnt really make any sense.
You should go back through your code and try and fix any things like that.
Awesty it’s fine you don’t need to post code i foun outa way to o it myself. I made it that if u touch an item it goes to an inventory off-screen and every time u touch the item it deducts a var by 1.(the default points is 5) So if u collect 5 items, ive made it that if the var (points) is equal to zero then it goes to a new frame.
That took me a
while to code :p
The -(_root.bally) changes the variable’s sign, if it is 5 it will be -5, so the ball starts going the other way. The second “if” is to check if the ball is going up or down, so i don’t have problems with the ball hitting and going down and then hit again and go up. I think the error is in the hitTest, because i made it using a lot of MovieClips inside the brick MC, and it worked (It didn’t work good enough though, so i tried this one). Is there anything bad with the hitTest? I can go back to my old way, but i didn’t like it much…
The hitTests look fine but half the code is missing. :\
beef is a delicious snack
is there a way to add another key frame through action script?
example I’m makin a drawing game where the person can just doodle and stuff but that seems stupid so i want to be able to click a button and create another key frame where they draw something different. then click a button to where it plays the first key frame so it’s like flash 8 in flash 8
here’s what i got:
http://showcase.sfdt.com/viewmovie.php?t=56682