Happy New Year! Stayed up the entire night myself, waiting in the new year watching movies, last nights sleep was heavenly. :P
Good luck with AS3 too, such big a difference the new.
Age 29, Male
Australia
Joined on 1/19/06
Happy New Year! Stayed up the entire night myself, waiting in the new year watching movies, last nights sleep was heavenly. :P
Good luck with AS3 too, such big a difference the new.
Thanks, Happy New Year to you too. I can't remember the last time I had a heavenly sleep, BUT PERHAPS ALL THAT WILL CHANGE. That can be one of my New Year's resolutions, along with AS3.
If you're using AS2, just use removeMovieClip. With AS3, you'll have to recycle objects (movieclips), otherwise they'll keep running until the new garbage collection thinger deletes it, and when it finally does it'll drop frames.
Yes, but removeMovieClip() only removes duplicate MovieClips created with duplicateMovieClip(). See, I'm not randomly generating the "foods" in this game, I'm simply placing them onto the stage. However this is not what I want in the final product, so I'd need to have some initial instance of them somewhere, but it could be invisible and not function the same as the duplicates.
Anyway, I suppose you already knew that, considering the games you've made. (They're very good, by the way, and some are a very similar concept to what I'm plagiaris--I mean working on. ;) )
If youre using AS2 simply make the food an MC with two frames. One frame with the food and one without. Put a stop(); action on the first frame, and then put this code onto the food:
onClipEvent(enterFrame){
if(this.hitTest(_root.Player)){
_root.food.gotoAndStop(2);
}
}
Youll have to change the instances in the script to suit what youre using but that should work. Also, im working on a game atm as well... ^^
Yeah, I can't believe I didn't think of that. The annoying thing would be that the MC would still be there, not that you'd notice it, but it just wouldn't seem perfect. =(
Also, as I mentioned above, I'll probably be duplicating the MovieClips in the end, for which I could use the removeMovieClip() function. Still, that's a good idea, and I could probably apply it to something else where I need to do that.
BTW: hitTest is totally crap. Unless you're testing squares, or doing a tile-based game, you don't really want to use it. I was going to use a circle-based collision test, but it didn't work for some reason. Anyway, I found I was better off with a shapeFlag testing a point.
Good luck on your game!
Edit: Oh noes! That didn't even work. I don't know the mouth area can hitTest against nothing, but Flash doesn't care. Anyway, no matter, for reasons explained above. (Because I really can't be bothered typing them again.)
Thanks anyway. =)
True, hitest is shit but it works for small objects, and those 'foods' youve got there look pretty small. Anyway you should check out a few tutorials if you want to use shapeflag because its more complicated shit than hitest.
Good luck and all :P
shapeFlag is basically:
if(_root.MC_GOES_HERE.hitTest(_x, _y, true)){
//Do shit
}
Anyway, I've got the whole eating thing sorted out, as well as the random placing of the foods. The annoying thing is, now they can sometimes be all grouped together in one place, and I'm having some depth issues, where they appear above everything, even the HUD. And I still want them to bounce off the guy, rather than sliding along behind him/her/it, or in this case, above. But it's working out... slowly.
You sound more advanced at AS than me, and your game looks a lot neater than mine does lol O_o
Right, I JUST realised why this post got so many comments.
<a href="http://www.newgrounds.com/bbs/topic/1012113/1">http://www.newgrounds.com/bbs/topic/1 012113/1</a>
RamblinEvil-Mushroom
oooh sounds neato, using AS3 or AS2? :o
blackduckie
I'm using AS2 at the moment, though I do intend to move on to AS3 later on. I'm mainly just pissed off that you can't put actions directly onto MovieClips, and that you have to create a separate class, which really annoys me. But once I learn a little bit more about it, I'll probably make the jump. (I've got a couple of books on AS3, too, a little something from Christmas. :D)