Don't Hate, Rotate!
Formally known as QWOPDroid.
So after a bumpy and rushed development its looking like we're starting to wind down and wrap up. This post will look into some of the difficulties we faced and some of the fixes we had to implement. When creating the asteroid field, we needed to set a random position to spawn them at, however as the time gap between this random number being generated was so small quite often it would generate the same number for all the asteroids. To solve this issue we created a list and added a set of numbers to the list. We then choose the first number in the list for the x position and the last for the y position and then shuffled the list so that the next asteroid would have different values (granted there is still a chance of it being the same, but this is very small). This does mean that there are a finite number of positions that the asteroids will spawn, it provides enough variation so that the player will not recognize.
Originally are input layer only used TouchEvent.ACTION_DOWN and TouchEvent.ACTION_UP When a finger touched the screen it would detect its position and determine which button it was on and add 1 to that colourCount. When a finger was lifted from the screen it would detect the position and determine which button it was on and remove 1 from colourCount. The problem with this is that it did not take into account movement of the finger when down. So I changed it to: switch(pSceneTouchEvent.getAction()) { case TouchEvent.ACTION_DOWN: colorList.set(pSceneTouchEvent.getPointerID(), checkColor(pSceneTouchEvent.getX(), pSceneTouchEvent.getY())); break; case TouchEvent.ACTION_MOVE:
colorList.set(pSceneTouchEvent.getPointerID(), checkColor(pSceneTouchEvent.getX(), pSceneTouchEvent.getY())); break; case TouchEvent.ACTION_UP: colorList.set(pSceneTouchEvent.getPointerID(), null);
break; }
(apologies for horrible formatting)
Then in the update function the colourCounts are set to 0 and check the list each frame.
A major problem was caused by trying to attach the engines to the main ship body. We had them attached as a child to the ship, but this then caused the body(physical component) to be incorrectly positioned. We managed to fix this by attaching the engines to the scene and using a weld join to attach them to the main ship body. Due to the nature of these joints it also offered a nice bounce effect on collisions.











