New answers tagged

0

Instead of having the nextString method in the key event method, have it in a update method. Similar to the comment, it depends on the OS, so they won't always be the same. This might have sounded confusing, here's an example: public void keyPressed(KeyEvent evt) { if(evt.getKeyCode() == KeyEvent.VK_LEFT) { player.runMotion = -1; } ...


0

I'm not sure if this is the way that that game specifically did it but what you do is create a texture which is then subtracted from other textures. So in this can you create a shape which represents the whole in the ground, then you when the bullet explodes it subtracts the shape from the ground texture and leaves a whole in the ground texture. When you ...


0

You can just draw holes over the floor object, here all the holes have their own class with separate properties from the floor class:


1

My apologies, I should have picked up on this quicker. Instead I made you get a screenshot that wasn't needed. Your not waiting for your WWW to complete before creating the sprite. So basically the www.texture is empty at the time you use it. Check www.isDone before working with the texture to see what I mean. If you do not want to do this in a Coroutine ...


0

Transform them in software using the CPU and give the GPU only the final vertex coordinates. The savings in bus bandwidth by reducing the VBO size will be greater than the cost of the transform on the CPU which can be greatly simplified by combining the sprite expansion and transform into a single step, no heavy matrix multiplication needed. 2D rotation, ...


2

When you have 2d sprites in a 3d environment, they work like two-dimensional planes. Think of them as cardboard-cutouts which are moving through the world. When you want to rotate these cardboard cutouts to always face the camera, then the search term you are looking for is "Billboarding". It can be implemented by attaching this MonoBehaviour to it: using ...


0

My guess is that you have a stray ! in your code. Remove the ! in: if (!Gdx.input.isTouched()) { This is making it so shootToward() is being called when the player is not touching the screen.


1

I would recommend you to place the 2d sprite not in the game world but instead place it on a UI canvas with "Screen Space - Overlay" mode. You can convert the game-world position of a GameObject to screen-coordinates using Camera.WorldToScreenPoint. Then you need to convert the screen coordinates to canvas coordinates and place your sprite there. Code ...


0

I had this same issue, I was using sprites with 8 different directions of movement. Here's how I detected which direction they were moving in: The way the sprite is facing depends on the direction they were last moving in. You can find the direction of sprite movement by performing some calculations on their original coordinates, and the coordinates of ...



Top 50 recent answers are included