本文介绍了单跳转功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我正在开发通过andengine游戏。我希望我的球员能跳一次。所以我用接触listner.but它并不总是work.mostly工作,但并非总是如此。检查codeS和告诉我我的错误吧。

我的球员object.and 10 Box2D的静态object.I不明白怎么能这样接触监听器检测到的球员,这些盒子之间的碰撞。因为我有其他的盒子too.for例如:玩家,正方形和圆形。为什么这种接触听众播放机和广场之间检测?为什么不圆和方的?

 私人ContactListener contactListener()
    {
        ContactListener contactListener =新ContactListener()
        {
            @覆盖
            公共无效beginContact(联系方式联系方式)
            {
                player.setJumping(假);
            }            @覆盖
            公共无效endContact(联系方式联系方式)
            {
                player.setJumping(真);            }
         };
         返回contactListener;
    }


解决方案

我想你想的碰撞机构从非碰撞bodies.This的帮助您

I'm developing a game by andengine. I want my player can jump only one time. So I used contact listner.but it doesn't always work.mostly works but not always. Check the codes and tell me the my error please.

I have player object.and ten box2d static object.I didn't understand how can this contact listener detect collision between player and these box. Because I have other boxes too.for example: player, square and circle. why this contact listener detect between player and square? why not between circle and square?

    private ContactListener contactListener()
    {
        ContactListener contactListener = new ContactListener()
        {
            @Override
            public void beginContact(Contact contact)
            {
                player.setJumping(false);
            }

            @Override
            public void endContact(Contact contact)
            {
                player.setJumping(true);

            }
         };
         return contactListener;
    }
解决方案

I think you want to separate collision bodies from non colliding bodies.This link helps you

这篇关于单跳转功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 07:54