New answers tagged

1

Have you tried using instead sf::Keyboard::isKeyPressed instead of an event based solution? (see http://www.sfml-dev.org/documentation/2.0/classsf_1_1Keyboard.php) static bool isKeyPressed (Key key) You could use this in a way similar to how you have it, after your input method. Sample code: while (window.isOpen()) { // handle input // ...


0

The answer lies in here : shapeLabel.setTouchable(Touchable.disabled); With this I am able to achieve what I intended to do. The other alternative I found is to relay the events using InputMultiplexer. But, I felt the above solution to be simplest.


2

If you require OnHealthChanged to be part of some interface of the game objects in question, you can attempt to cast any arbitrary game object to that interface and then call the method: // ...given... interface ISupportHealthChangedNotification { void OnHealthChanged(); } var supportsHealthChanged = someGameObject as ISupportHealthChangedNotification; ...


0

Without the exact error I can only assume what the problem is. Both Player#getItemInHand(), ItemStack#getItemMeta() and ItemMeta#getDisplaName() can return null and thus can throw a nullpointer exception. You need to check if any of these is null before using them.


-1

You must to divide your whole world into parts, and check is each of them is close/further from your position. It gives you priorities how frequently you should update your map part. Because there are some algorithms which allow to optimise such updates.



Top 50 recent answers are included