简体   繁体   English

如何使用Box2d在andEngine中制作弹丸轨迹?

[英]How to make a projectile trajectory in andEngine using Box2d?

I am new to gaming world development in android, as its reputation precedes the obvious choice in development was and-engine and Box2d for physics. 我是android游戏世界开发的新手,因为它的声誉早于开发中显而易见的选择是and-engine和Box2d用于物理。 So far I have managed to get a hold of basic functionality of the engine and methods... 到目前为止,我已经掌握了引擎和方法的基本功能...

But few or more things are not clear so far..Which method to override when dragging a sprite on the scene? 但是到目前为止,尚不清楚几件或多件事情。.在场景上拖动精灵时可以覆盖哪种方法?

I am doing all the experimentation in onActionMove method, which is found in onAreaTouched method... Previously, I asked the same query on another forum, and someone advised me to go through this post and port it into java code. 我正在onActionMove方法中进行所有实验,该方法位于onAreaTouched方法中……以前,我在另一个论坛上问过相同的查询,有人建议我阅读这篇文章并将其移植到Java代码中。 I tried to convert it to the best of my abilities, but in vain. 我试图将其转换为我的能力,但徒劳无功。 Could someone possibly guide me through the procedure and methods to look into in order to achieve the functionality, or give a detailed walk-through the flash version of the code. 有人可能会指导我完成查找过程和方法,以实现功能,或者详细介绍代码的Flash版本。

Cheers. 干杯。

This is a basic listener for that, expand it according to your needs. 这是一个基本的侦听器,请根据您的需要进行扩展。

mScene.setOnAreaTouchListener(new IOnAreaTouchListener() {
    @Override
    public boolean onAreaTouched(TouchEvent pSceneTouchEvent, ITouchArea pTouchArea, float pTouchAreaLocalX, float pTouchAreaLocalY) {
        if (pSceneTouchEvent.getAction() == MotionEvent.ACTION_MOVE) {
            sprite.setPosition(pSceneTouchEvent.getX(), pSceneTouchEvent.getY());
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM