我正在尝试创建一个具有牛顿物理学的游戏。
在您阅读其余内容之前,这是我要寻找的以下主要问题:
- 尝试运行代码后,我一直收到在窗口中弹出的错误。我缺少什么库或dll?
我有一个苹果,一个橘子和一支铅笔。我已经使用子弹式物理引擎阅读了大多数文档,但似乎无法让苹果像纸一样工作(二维)。Box2d物理引擎等不是我想要的。我不喜欢现实生活中的盒子,更不用说在网络世界中了。
我希望苹果漂浮在地上,像纸一样来回摆动。该站点提供了一些有用的信息,这些信息已集成到我的代码中:htp://www.3dbuzz.com/vbforum/showthread.php?50854-Please-HELP !! -Simulating-paper-floating-to-ground
对于让您使对象的行为像其他类型的对象一样的游戏,我有这个想法,但是我对游戏的模拟无法正常工作。
我经历了太多种类的苹果,无法计数,甚至没有一个接近。我曾尝试寻找其他尝试过类似事情的人(使用诸如http://lmgtfy.com/?q=simluating+game+apples+in+real+life之类的Google),但从来没有返回过苹果!
因此,我认为我要进入新的领域(不用担心,我将开放我的技术的源代码),这就是为什么事情对我不起作用的原因。
我尝试过编程各种苹果,但是也许我需要一个网络苹果?我不知道在哪儿找到这样的东西,也许是在这样的地方:http : //cyberapples.com/虽然该站点目前处于关闭状态-它只是谈论某些cgi垃圾桶之类的东西。还有任何提示吗?
这是我的代码部分,涉及苹果模拟游戏内容:
///... /* setup other objects in the room and other stuff */ ...
// see http://www.orangepippin.com/apples/arlet-swiss-gourmet
// for more arlet apple details
paper_2d_behaving_apple = new ArletApple[);
/ setup the arlet apple's general characteristics
paper_2d_behaving_apple.species = SPECIES.MALUS_DOMESTICA;
paper_2d_behaving_apple.parentage = PARENTAGE.GOLDEN_DELICIOUS_X_IDARED:
paper_2d_behaving_apple.introduced = make_year(1958);
paper_2d_behaving_apple.fruitColor = COLORS.red;
paper_2d_behaving_apple.fleshCOlor = APPLE_FLESH_COLORS::CREAM;
paper_2d_behaving_apple.fruitSize = GENERIC_FRUIT_SIZES.MEDIUM;
paper_2d_behaving_apple.GoodFor.add("eating fresh");
paper_2d_behaving_apple.GoodFor.add("cooking");
paper_2d_behaving_apple.GoodFor.add("use / keeping: 3 months or more");
paper_2d_behaving_apple.GoodFor.add("ripening PERIOD: 3 months or more");
paper_2d_behaving_apple.diseaseResistances = [DISEASE_RES::SCAB, DISEASE_RES::MILDEW];
///... (I cut some of this out for brevity's sake) ...
///* setup this specific apple's characteristics
paper_2d_behaving_apple.base_color = 0xff2000;
paper_2d_behaving_apple.bumpMap = BUMP_MAP_APPLE;
paper_2d_behaving_apple.texture = TEXTURE_REALISTIC_APPLE;
paper_2d_behaving_apple.feel_texture = SMOOTH;
paper_2d_behaving_apple.has_small_orangey_stripes = TRUE;
paper_2d_behaving_apple.DoesntHaveStem = FALSE;
paper_2d_behaving_apple.juicy = true; // needs a lowercase true for some reason
paper_2d_behaving_apple.has_bugs = false; // heck no it doesn't, I only buy good apples
///... (again I cut some stuff out so this post would'n't be too long) ...
// from http://www.3dbuzz.com/vbforum/showthread.php?50854-Please-HELP!!-Simulating-paper-floating-to-ground
// "i think reactor can do this, i would try cloth witha high air resistance and a very high stifness"
paper_2d_behaving_apple.addReactor(REactor());
// got this technique from http://www.gimptutorials.eu/html/clothify_filter_gimp_gnu.html
import gimp ; GIMP::Clothify(paper_2d_behaving_apple); pass
// / 7 should be high enough - it's a big number
paper_2d_behaving_apple.reactor.stiffness = 7.0f;
paper_2d_behaving_apple.reactor.airResistance = 5.0f; // high, but not "very high"
// setup the world the apple exists in
paper_2d_behaving_apple.owner = new BobFlanderson();
paper_2d_behaving_apple.owner.appearance = APPEARANCE_AWESOME;
paper_2d_behaving_apple.owner.clothes.size = CLOTHES_SIZE_MEDIUM;
paper_2d_behaving_apple.owner.owns_house = false;
paper_2d_behaving_apple.owner.apartment.sucks = true;
paper_2d_behaving_apple.owner.has_wife = false;
paper_2d_behaving_apple.viewSpace = LIVING_ROOM;
paper_2d_behaving_apple.RESTINGon = Kitchen.GetSurfaces()->COUNTER_BY_STOVE;
////... (also cut some more out here too) ...
// transform the paper behaving apple into something viewable
view_matrix = new ViewMatrix();
view_matrix.DoTransformation(paper_2d_behaving_apple);
view_matrix.makeViewable();
World->ApplyViewMatrix(view_matrix);
paper_2d_behaving_apple.RenderToNeakedEye();
// THIS IS WHERE I'm HAVING THE TROUBLE
actual_existing_apple_on_myCounter = new ExistingApple(paper_2d_behaving_apple);
actual_existing_apple_on_myCounter.bindInRealLive();
// THIS NEVER WORKS! I DON"T KNOW HOW YOU GUYS DO THIS STUFF!
actual_existing_apple_on_myCounter.Translate(LANGUAGES::ENGLISH);
// saw the IW_FIXED on some jam making site
// (http://www.madewithmarmalade.com/devnet/documentation#/api/api/group__IwGeomCore.html)
// - that's the closest I've come to seeing anything close to what
// I'm trying to do
actual_existing_apple_on_myCounter.TranslateTo(0, 0, IW_FIXED(10.0f));
apple_now_inAir = actual_existing_apple_on_myCounter;
// I know this is C++ code, but some ruby sites were saying that it's best
// to put an exclamation point after a function that modifies a physical
// object - no luck yet for me
apple_now_inAir.Drop!();
如您所见,我已经掌握了基本概念,并且对变量名和对象属性的描述非常准确。尽管我比实际厨房简化了游戏中的世界,但我非常简洁明了地设置了世界。
我认为问题是paper_2d_behaving_apple
将actual_existing_apple_on_myCounter
苹果绑定到苹果上,然后将其空中传输到苹果上apple_now_inAir
。
不管是什么情况,无论我格式化所有内容的方式如何,似乎都不会发生。下面是我如何运行程序的图像:
有人遇到过吗?提前致谢。我只是从编程游戏开始,最近转行了,所以不要感到难过。
谢谢,鲍勃
apple_now_inAir.Drop!();
是一场骚乱。这个职位有一些东西-雄心勃勃,困惑,注定要失败……