[3D框架]Alternativa3D 专题总编:D5Power [游戏开发]Flash游戏常见功能与实现 专题总编:D5Power [游戏开发]游戏性能优化 专题总编:D5Power [游戏开发]D5RPG 专题总编:D5Power [游戏开发]AI-Steering编程 专题总编:D5Power [MVC框架]FlashBuilder_和_PureMVC 专题总编:D5Power [移动开发]Flash移动开发 专题总编:D5Power [游戏开发]Flixel 横板游戏制作教程 专题总编:mztknb [入门系列专题]★天地培训★新手入门-AS3开发案例 专题总编:S_eVent [游戏开发]做一个像植物大战僵尸的Flash游戏 专题总编:逐日|者 [入门系列专题]Flash动画学习指南 [入门系列专题]从零开始学AS3游戏开发 专题总编:D5Power [MVC框架]Cairngorm专题 专题总编:taotao5453 [MVC框架]PureMVC专题 专题总编:夜歸人 [流媒体服务器]Red 5专题 专题总编:Lost_in_Flash [工具使用]Flash develop专题 专题总编:阿新 [游戏开发]图形处理专题 专题总编:a355112007020 [游戏开发]寻路专题 专题总编:smallghost [3D引擎]Away3D专题 专题总编:xiao198304 [3D引擎]Sandy3D专题 专题总编:sindney [UI框架]Aswing专题 专题总编:393725437 [多媒体]音乐播放专题 专题总编:xiaohaiyong [网络通信]Socket专题 专题总编:smallghost [网络通信]P2P专题 专题总编:eity0323 [网络通信]AMF专题 专题总编:forever_to_our & crylg [性能优化]文件大小专题 专题总编:KengPanda [性能优化]内存回收专题 专题总编:KengPanda [物理引擎]Box2D专题 专题总编:smallghost [物理引擎]APE专题 专题总编:tcper [交互设计]增强现专题实 专题总编:evin [后台语言]Java专题 专题总编:cloud21 [后台语言] C#专题 专题总编:smallghost [Flex]Flex4专题 相关专题总编:iceblue
返回列表 发帖

[AS3] AS3 Dice Class & Dice Tester :色子机系统

嘿嘿,有人对DND系列(龙与地下城)游戏感兴趣的话,一定会知道色子有很多类,
从4面色子到20面色子~~

嗯嗯

在AS3实现起来也很简单,呵呵这个类已经方便的提供了基础的几个,
有需要的朋友可以去下载咯~!!

演示:
http://files.hexagonstar.com/labs/diceclass/dicetester.swf

下载地址:
http://files.hexagonstar.com/classes/as3/diceclass.zip

原文:

AS3 Dice Class & Dice Tester

In game development randomness is often necessary for certain tasks, be it the random distribution of graphic tiles, a random factor in NPC AI or random stats in a roleplaying game. Especially for the latter purpose the static Dice class provides a set of methods to roll dice as it is common in a RPG, to be exact four-, six-, eight-, ten-, twelve-, twenty-sided and percentile dice.
The Dice class (and it’s supporting classes) are rather elaborated, using for example the Linear Congruential algorithm in the process of generating ‘true’ random numbers so it might not be the most speed-optimized method for calculating random numbers. For absolute performance the LCA and rounding routines can be removed to speed up calculations.
Using the Dice class is very simple! For example rolling two ten-sided dice can be done with the following call …
var result:int = Dice.tenSided(2);
… rolling the percentile die is even simpler as it does not need any arguments. It always returns a value between 1 and 100 …
var result:int = Dice.percentile();
… the class also provides the roll method with that any x-sided die could be rolled, 3 sixteen-sided dice for instance …
var result:int = Dice.roll(16, 3);
The following application uses the Dice class and can be used to test dice throw probability according to the bell curve (the more dice are used the lower the probability to roll boundary results).

[ 本帖最后由 KingFo_HZ 于 2007-12-25 14:13 编辑 ]

More...楼主的最近发帖

最新精华帖

等等,我在吃饭.哦,还没洗脸,迟到了?别急!还有半个小时才来公交!

返回列表

江湖传闻 关闭


天地行·上海讲师招募火热进行中…

予人玫瑰手有余香,你想成为讲师么?想与更多的精英开发者分享你的经验么? 快来申请9RIA天地行讲师吧!在这里通通满足你! ...


查看