1 decade ago by IMBilleh
Hey everyone,
Right now, I'm working on a puzzle game similar to Tetris Attack. However, I'm a bit stuck. I'm making all the Block entities increment up over time by using the vel.y.
Once the blocks have moved up a certain amount, new blocks should be created underneath. I am having difficulty with this part...
At first, I decided that every update, I would increment an index and once it reaches the limit, it would create the new line of blocks and would be put back down to zero. This failed to work because of the way Impact does updates. The number of updates called is very dependent on the device it is run on.
Then, I decided that once the blocks moved a certain number of pixels (based off the velocity), then I could check that way. However, the y-positions of the entities get off after several updates. So even though after three seconds with velocity of 30, the entity should move exactly 90 pixels, it will actually move 89.99850 or 90.99850.
So my question is, how do I handle this problem? How do I ensure that my entities move exactly how I want them to?
P.S.
Just as an added extra because someone might mention it, I also thought of completely removing the automatic update and just update my own positions with the pixel positions I desire, but I run into problems with lagging and not smooth transitions. Impact does very well at keeping the actions smooth, but if you have a better method, by all means, enlighten me =)
Right now, I'm working on a puzzle game similar to Tetris Attack. However, I'm a bit stuck. I'm making all the Block entities increment up over time by using the vel.y.
Once the blocks have moved up a certain amount, new blocks should be created underneath. I am having difficulty with this part...
At first, I decided that every update, I would increment an index and once it reaches the limit, it would create the new line of blocks and would be put back down to zero. This failed to work because of the way Impact does updates. The number of updates called is very dependent on the device it is run on.
Then, I decided that once the blocks moved a certain number of pixels (based off the velocity), then I could check that way. However, the y-positions of the entities get off after several updates. So even though after three seconds with velocity of 30, the entity should move exactly 90 pixels, it will actually move 89.99850 or 90.99850.
So my question is, how do I handle this problem? How do I ensure that my entities move exactly how I want them to?
P.S.
Just as an added extra because someone might mention it, I also thought of completely removing the automatic update and just update my own positions with the pixel positions I desire, but I run into problems with lagging and not smooth transitions. Impact does very well at keeping the actions smooth, but if you have a better method, by all means, enlighten me =)