Tuesday, August 16, 2011

Specific Spawning

Since I've already had a good base of the enemy class finished, I decided it was time to figure out how I was going to specify where they would spawn. So, as usual, I started a new class called 'EnemySpawner' (Believe it or not!), that would take care of most of the functionality. There were the basic fields like Texture and Vector position, but there was also a couple fields such as spawnRate and spawnTimer that were quite important.

For the texture, I quickly done one up on Photoshop.

Its just rough and temporary. (Hopefully Lynch can improve it a good bit!)

After giving the texture a position and drawing it to the screen, it was just a matter of specifying the spawn rate. I used the 'TimeSpan' keyword and set the spawn rate to two seconds. Then the spawn timer is set to zero initially. By now, I had created a list to hold any enemies that were being created. So every two seconds an enemy is created at the specified spawn point and added to the list.

Thats about all that was needed for the spawning, initially anyway. Further down the line I expect that the spawner will be placed just as the rest of the items on the maps are.

Tuesday, August 9, 2011

It made sense at the time...

Up until now, I had been doing any and all code in a Windows Game project. This wasn't a problem until it came to fine tuning the controls for the player ship. I had the basic movement done, but this wouldn't be good enough for the type of game we had in mind. We were looking for accurate rotation and acceleration depending on how much the player moves the virtual thumb sticks (thats something for another post!).

So at the time, I attempted to translate some virtual thumb stick acceleration and rotation to key presses. After a good long while trying this method, which made sense at the time, I realised that it would be much easier and waste much less time, to create a Windows Phone 7 project instead. After doing this, I put all my existing code into the new project and added the new movement using the touch controls. I don't have a Windows Phone 7 to deploy the project on myself, but the emulator works well for what is required.


(I was supposed to put an image of the game running on the emulator here, but Print Screen doesn't seem to work while the emulator is running!)

Tuesday, August 2, 2011

Hidden Areas

After finishing the Player class (for the time being at least), there was quite a few other aspects of the game that were easier to start on. For no reason in particular, I decided to have a look at how we were going to handle the hidden or secret areas in the game. We had already confirmed that we would have an area every now and then that wouldn't be too obvious to start with, but after searching around a little bit, would be revealed. We came to the decision that the best way to achieve this, would be to hide these areas behind regular walls/pipes that surround each level.

For starters, I needed a temporary wall to experiment with and see what would look best for the game. I drew up a very simple and fairly terrible pipe in Photoshop, for what was intended it was fine!


Firstly, I decided to have a look at how I would detect the players proximity to the wall rather than the effect that was going to indicate the secret. Thankfully there is a great function of 'Vector2' called 'Distance'! Using this, all I had to do was specify what distance between the two objects would trigger the effect.

I tried out a couple of different effects on the wall, such as a pulsating effect and one that grows the pipe temporarily. But we settled with what we thought looked best, which is a fading effect on the pipe. For this effect I needed a few new fields, such as an alpha value and a speed at which to fade.

After trying out different speeds and different levels of opacity, I settled with a slow(ish) fade to half opacity when the player is within a certain distance of the pipe.


(You can ignore the end of the relentless enemy in that last picture!)