Thursday 31 March 2016

2D game assignment Dev Blog - Week 4

Week 4 we hit a road block.
And I mean a really, really big roadblock.

We had two major problems, well actually three but I was ignoring the third one hoping it went away.
The first was that we had a problem with the gun script. For some reason the bullets were not going were we wanted them to. Not in the way that they were flying about the screen like someone gave a toddler a uzi. Instead they were not hitting where we clicked. Somehow even though the bullets were going in the direction that the player was shooting, they weren't hitting anything.
This didn't make sense. At all.

Added to that we still had trouble getting guns to enable when the player activated a pickup.
The thing was we had tried out multiple ideas to get the gun to work after pickup. Like for example the gun prefab being attached to the pickup. Then again we were in experienced with coding, so none of the ideas worked. 

So like all great developers we asked Ewan for help.

Thankfully Ewan was able to help us sort out the pickup problem. Instead of the gun being a separate object to the player, we kept the gun attached to the player, but disabled it on game start up. It was only after the player activates the pickup that the gun is enabled. How cool is that.

Now the bullet problem, we tried a number of things to get the bullets to go where we wanted them to, like a bullet target that was attached to the mouse, and other things. But in the end nothing worked, the idea had us all stumped as to why the bullets would go in the direction we wanted them to, but not hit anything.
Then I noticed I was an idiot and had the bullet prefab rotated slightly, so it was going in the direction we wanted, just the aim was off a bit. 

Honestly though without Ewan we would not have been able to figure out the problem with the pickup script, and other code problems.

Bless you Ewan our savior.

[ARTIST CONCEPTION]

No comments:

Post a Comment