Game Progress Update #48

Game Progress Update #48

Hello World! And welcome to the forty eighth Dev with Dave Game Progress Update! 🙂

After Update 47, there is not much to report this update, but after some dogged perseverance (it’s my specialty, lol) I have finally managed to get the scratch cards working!

Unfortunately, I’ve spent almost every hour I’ve had to work on Flappy-vaders, working on the scratch cards so other than this progress update, I’ve not done much else.

Fixing the scratch cards..

The first thing I did was to remove all the existing debug from the screen. I have a terrible habit of printing debug info straight to the screen and not removing it when I’ve solved the issue. There was quite a buildup of debug info at the top of the screen, lol.

A screenshot of the scratch card test program showing the debug inforation.

Then I decided which values I was going to compare between the working test program, and the code in game.

This result showed me that the image size of the panels was the only difference, which made sense. The test program uses the GetImage() command to create images. Where as the actual game loads the images from file.

I then added a line to the code which loads the images in the game which resized the image to the specified width and height. But this caused some unexpected/undesirable effects in the other graphical assets. I’m not entirely sure why this was, but as I only need the silver scratch card images resizing, I used the filenames in a conditional.

I’m happy to announce that this worked fine. 🙂

Adding to the scratch cards

I think I need to add some code cleanup though. Repeatedly doing the daily prize thing causes slowdown, probably due to creating new images/sprites/memblocks etc.

I downloaded some free fruit images which were about the right size to use as placeholder graphics. Then I wrote some code to place them randomly behind the silver panels.

I still need to write a system which records the selected fruits and checks how scratched the cards are before going on to the next bit.

I need to create a UI page to show before going straight to the scratcher screen. This is planned out on paper but haven’t had chance to actually code it yet.

Thats all for now

And that has been all I’ve managed to do this update. I’m hoping to have the scratch cards finished in time for the next update, and maybe get some other things ticked off the trello as well.

I’ll be back in next fortnight with another update.

Game Progress Update #47

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…

Daily Prizes

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 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.

The results

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..