Game Progress Update #47
Hello World! Welcome to the forty seventh Dev with Dave Game Progress Update!
It’s currently gone 3pm on Monday the 10th of October, and this post is 3 days late already! Which is not ideal, especially as I had other stuff to be doing today and now will probably end up stuck in the office till gone 11pm tonight again *sigh*
How did this all go so wrong? I was feeling super positive come Friday afternoon, and had made some great progress with what I was working on. Let me tell you all about it…
So, for this update I was hoping to have modified the Scratch card code and have got that working inside the game ready to be shown off on Friday.
Converting the code was fairly straight forward. I created a typed array to store the data in, and then created a function to create a scratch panel, and another to update them.
I further optimised the code by ensuring it was only checking the panel the mouse was over, instead of all the created panels which was causing a considerable slow down as it was using a For loop.
Above is a photo of the scratch card experiment program running on my Samsung Galaxy S20, I’d scratched off three of the panels and realised I needed a way to tell if the panels had been scratched off or not.
I did this by adding two new variables, one which stores the total number of pixels in the panel, and another which stores the number of pixels marked as clear by the code. Using these two values I can work out a percentage of how clear each panel is.
Creating some assets
Earlier in the week, I’d decided to research some scratch cards and had spent a little while gathering images from the internet.
Next I opened up Paint.net and started creating an image to use in the game to represent the scratch card.
(Actually at this point my mind started wandering, and I imagined having a range of half a dozen different scratch cards, each with its own panels and background art. But this was definitely feature creep and not in the remit for today, so I just made the one card for now.)
Putting it all together
By now it was about lunch time, and all I had left to do was copy the new script into the game, make sure it worked ok, and then write this blog post.
This is where the first disaster struck. Because no matter how hard I tried to get the code to work inside the game, I couldn’t.
I wasted hours making tiny changes here and there to the code, but to avail. Everything seemed to be working looking at the debug, but the panels wouldn’t scractch correctly.
Had I been thinking clearly, I’d have just written the blog post about the modifications I’d made to the example code, but sadly I was feeling unstoppable because of how well I’d done that day and I was convinced that I could get it working in time.
However, come 11 pm that evening, I’d had enough and went to bed, planning to finish off on Saturday and have everything published by lunch time.
This however was not to be, as I had family stuff to do all weekend.
Ok, so here is a quick video which I made demonstrating the scratch card example effect, and then the same code working in game. (Ignore the black spot, it’s usually an invisible sprite. whose job is to act as the coin and remove the silver panel as you scratch)
As you can see, there is definitely something wrong with the way that it works in game. I have a few ideas as to what, and hopefully will have it working next time round.
Thats all for now
I’ve sadly run out of time for this update (especially considering it was due Friday! lol), but I’ll be back in two weeks with another update which will hopefully be slightly more on time.
Until next time..