人物硬币收集混乱 [英] Character Coin Collection Confusion

查看:70
本文介绍了人物硬币收集混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我正在使用AS2制作简单的平台游戏。到目前为止,我希望这个角色收集硬币或其他任何东西。所以我所做的就是创建一个硬币电影剪辑,我在硬币和我的角色上进行了最热门测试,当这个=真时将硬币设置为_visible = false,将其移出屏幕并向_global添加10点。得分了。一切正常,但我不知道有多个硬币的实例,或者更确切地说我有一个线索,但我不想不同地命名所有实例并且有大量的if语句(每个实例一个)。我确信有一种更简单的方法,我想我只需要一些方向。


我是AS2的新手,所以请放轻松我。

Hi I''m using AS2 to produce a simple platform game. So far so good I would like the character to collect coins or whatever. so what I have done is create a coin movie clip, I''ve run a hittest on the coin and my character and when this = true set the coin to _visible = false, move it way off screen and add 10 point to the _global.score. all is working fine but I haven''t a clue about having more than one instance of the coin, or more precisely I do have a clue but I don''t want to have to name all the instances differently and have reams of if statements (one for each instance). I''m sure that there is an easier way and I guess that I just need some direction.

I am new to AS2 so please go easy on me.

推荐答案

duplicateMovieClip()方法可以帮助你。


我认为重复方法要求你重命名每个实例吗?所以,如果我想引用一个特定的实例,我需要为每个命中测试都有一组单独的代码?
am I right in thinking that the duplicate method requires you to rename each instance?? so if I wanted to refer to a particular instance I would need to still have a separate set of code for each hit test??


我跟一个我知道的关于这个的人说过,他建议一个数组,我可以看到他的观点,但我真的不知道如何实现它,他之前没有使用过闪存。
I spoke to a some one I know about this, he suggested an array, which I can kind of see his point but I don''t really know how to implement it, and he has not used flash before.


这篇关于人物硬币收集混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆