qertpartners.blogg.se

Scorched 3d android
Scorched 3d android






scorched 3d android

GlVertexPointer(2, GL_FLOAT, 0, vGroundLevel) This information is copied into a point array, which is rendered with glVertexPointer, glColorPointer, and glDrawArrays, as a triangle strip, like this: // prepare vertex bufferįor (int i=0,j,k=0,K=480 k0 ? 0 : offsetY Points with odd numbers represent the vertical pixel location of the terrain. Points with even numbers represent the line of pixels at the bottom of the screen. To render the terrain, I used OpenGL to draw a polygon with one pair of vertices at each horizontal screen location, like this: 1 3 5 7 9 Since Scorched Earth is a turn-based game, it seems like a good idea to have the game wait until the ground is settled until switching to the next player. This can interfere with the shot, and the interference can change depending on how quickly the next player fires. There are situations where the ground is still settling from one player's turn when the next player fires a weapon. You can see evidence of this in iShoot as well, since iShoot uses a slowly settling animated terrain. I decided to stay true to the original and have the terrain settle instantly, but while I was considering having animated terrain settling, I ran into some performance problems. Soviut's answer is great! I use a similar algorithm in the destructive terrain feature in Scorched Earth for iPhone. I'm keeping my original response intact since it helps explains the actual principle behind the collapsing terrain. It would be much faster to move all indexes of terrain above the gap down at the same time, for example.Īs the first comment states, a sort on the list is even easier. This is the basic approach, not the most efficient one. Repeat the process by iterating from that the old 0 position + 1. Then, as you continue to iterate, upon discovering a 1 (terrain) simply shift the 1 to where the 0 was. To make the floating terrain collapse, iterate over the array, keeping track of the first position you find a 0 (empty space). You're now left with a floating piece of terrain above another piece of terrain. Lets assume the terrain is struck from the side and a hole is made: In this case, I've set up the left side of the array as ground level, to element would be on the ground: If any gaps are detected, shift the terrain above the gap down to the lowest point possible in your column.Ī simple example of this could be done with an array where 1 represents solid terrain and 0 represents empty space. If you actually want the terrain to collapse like it did in Tank Wars, you'll need to iterate over each column of your image and have it search for gaps between the terrain and the bottom of the playing field. Hit detection is always done on the mask. As I recall, in Worms they used two images The "pretty" terrain with colour, and a mask terrain that is pure black and white.








Scorched 3d android