Chicken Launcher - A Bird Flinging Game


(Holmes) #1

Chicken Launcher - v 1.1

Chicken Launcher is a fun lil’ game I made for the Playstation Vita and ported to the Arduboy based off of Kitten Cannon. Shoot a chicken as far as you can, trying to hit springboards to give you a boost, but watch out for spikes! Your high score will be recorded and saved. If you think you get a big high score, Tweet me a pic!

#Controls

A: Set X velocity and Y velocity
B + Up: Erase game data

Downloads

Download Sketch: http://crait.net/proj/ChickenLauncher.ino
Download HEX: http://crait.net/proj/ChickenLauncher.hex
Download .ARDUBOY: http://www.crait.net/arduboy/chickenlauncher/ChickenLauncher.arduboy

Links

Follow me on Twitter for more updates and releases: @crait
Check out my site for my other stuff: http://crait.net/?projects
If you’re interested in the PS Vita version, check out my post here: http://wololo.net/talk/viewtopic.php?f=116&t=46786

Changelog

1.1: September 9, 2016

  • Switched to standard get()/put() for storing data into EEPROM
  • Fixed potential text issue
  • Removed title and instruction screen from repeating
  • Added the option to erase game data (B + Up)
    1.0: September 8, 2016
  • Initial Release

(Scott) #2

@crait,
F.Y.I. The Arduino IDE provides ways to write and read “anything” to/from EEPROM using the put() and get() functions.


(Scott) #3

@crait,
After disabling the code that loads and saves the high score to EEPROM, this game compiles and runs on my Arduboy-Z prototype system. However, the faster processor makes it run much too fast.

You should consider using setFrameRate() and nextFrame(), or some other method to pace the game based on real time, if you want it to be more portable and “future proof” for other hardware.


(Holmes) #4

Wow! I love living in the future! I’ll be sure to include this in my future updates/releases.

That’s awesome! Did you do anything to limit the speed? Did you try the game out? What did you think?

I’ll definitely take that into consideration in the future! I always appreciate your feedback.


(Scott) #5

No, not yet. I spent the remainder of my time yesterday trying to debug a problem with the “New high score” screen, which I’ll discuss below.

I played it on my real Arduboy. It’s kind of fun for a while but gets boring quickly, since once it starts you just sit back and watch, with more or less random results. Even the setting of the vectors at the start is kind of like rolling dice, with little skill involved. (You’re welcome to point out the same thing about my ArduboyLife sketch in this respect :smirk: )

I have a couple of suggestions:

  1. After the first time, when starting a new game after displaying the score(s), skip the intro screen and instructions and go straight to setting the vectors. It becomes tiresome to manually have to skip these screens each time.
  • Add a way to reset the high score. If another sketch has written values to your EEPROM save area you can end up with a huge high score value. Also, people may want to reset the high score, (for example, if someone else was playing the game), without having to load a separate sketch to clear EEPROM.

Now, regarding the problem I mentioned above with the “New high score” screen:
On my Arduboy-Z ARM based system (not on a real Arduboy) this screen is either skipped completely if the high score is 9999 or less, or the game locks up on a blank screen if the high score is 10000 or higher. After some experiments, I think it has something to do with the sprintf() function used to format the NEW HIGH SCORE! message. I didn’t go far enough to determine the exact problem. It could be the \n line break included, or maybe just the long length of the format string. I didn’t investigate further because I suggest that you don’t even use sprintf()

In addition to printing strings, the print() function is able to format and print numbers. Your use of sprintf() is simple enough that it’s easy to just use print() instead.

Here are changes that I made to eliminate using sprintf() (I’ve commented out the original code):

The text[] array is no longer needed:

//char text[24];

In the three blocks that use sprintf():

        arduboy.setCursor(0, 0);
//        sprintf(text, "%li", distance);
//        arduboy.print(text);
        arduboy.print(distance);
        arduboy.setCursor(25, 30);
//        sprintf(text, "NEW HIGH SCORE!\n        %li", highscore);
//        arduboy.print(text);
        arduboy.print(F("NEW HIGH SCORE!"));
        arduboy.setCursor(48, 38);
        arduboy.print(highscore);
        arduboy.setCursor(30, 19);
//        sprintf(text, "SCORE: %li", distance);
//        arduboy.print(text);
        arduboy.print(F("SCORE: "));
        arduboy.print(distance);
        arduboy.setCursor(10, 34);
//        sprintf(text, "HIGH SCORE: %li", highscore);
//        arduboy.print(text);
        arduboy.print(F("HIGH SCORE: "));
        arduboy.print(highscore);

sprintf() pulls in a lot of code for its formatting logic. With the changes above, the displayed output is the same as before but the code size is reduced by 1266 bytes.


(Holmes) #6

Awesome! Thanks for testing the game and giving your feedback. I actually went back and updated the game to 1.1 with all of these suggestions. I’m going to go back and update my other games to add a feature to erase the game data because that’s really important for a system that doesn’t have specific guidelines to memory management.

As far as adding more agency to the game, I’ll have more games later on that are more interactive. This is just one of my favorite mini-games from back in the day, so I wanted to stay true to its play style and not include too many more features that I’ve seen in other clones.


(Scott) #7

@crait, I think you made a copy/paste error in V1.1 on line 772:
arduboy.print(maxchickeny);

Shouldn’t it be?:
arduboy.print(distance);


(Holmes) #8

O_O

YES! That was a mistake! I was testing something!!! I switched it back, so we should be gucci.


#9

How do I download the file? When I click the link, I just get a webpage of text


(Pharap) #10

Right click, “Save Page As”, find where you want to save it, then (assuming you’re on windows) choose “All files” from the drop down menu before pressing “Save”.


#11

I can only see an option to save as HTML


(Holmes) #12

There are actually 3 ways to download this game, so I’m not sure which “file” you’re having trouble with. Is it the .HEX file? (You shouldn’t use that one!) Or is it the .INO file? I’m assuming it’s the .INO file. If it is, you can copy/paste all of the text into a new .INO file in the Arduino IDE. If this sounds confusing to you, I’ve also included the .ARDUBOY file, which you can find, here: http://www.crait.net/arduboy/chickenlauncher/ChickenLauncher.arduboy

If you’re unsure how to transfer that file, no worries! You can rename it to ChickenLauncher.zip and open the file up manually to get the .HEX file out if that was your issue. Otherwise, you can use my Arduboy Manager app to download this game, which can be found, here: Arduboy Manager 2.0 Released! This program will allow you to upload .ARDUBOY games, but it also shows you a list of games I have hosted on my server, including Chicken Launcher, meaning that it’s probably unnecessary to even download the file once you use this program.


(Pharap) #13

Which browser are you using?

To double check, it’s the .hex link you’re clicking on right?
And the text that comes up looks like this?:

:100000000C94200A0C94480A0C94480A0C94480A50
:100010000C94480A0C94480A0C94480A0C94480A18
:100020000C94480A0C94480A0C9451150C94C3156E
:100030000C94480A0C94480A0C94480A0C94480AF8
:100040000C94480A0C9453110C94480A0C94480AD6
:100050000C94480A0C94480A0C94480A0C946610B4
:100060000C94480A0C94480A0C94480A0C94480AC8
:100070000C94480A0C94480A0C94480A0C94480AB8
:100080000C94F1110C94480A0C94480A0C94480AF8

(And so on.)

@crait’s right that if you can learn how to use the Arduino IDE then it’s often a lot easier than using the .hex, though’ll still come up as “a webpage of text” so that still leaves the issue of how to download a plaintext file in whatever browser you’re using.


#14

I use Edge for my browser


(Pharap) #15

Hrm, I can’t find anything useful online about the context menu of Edge.

Looks like it might be easier to copy and paste the text into notepad and then save it with the right extension.
Just in case you don’t know how to do that (sorry if you do know most of this, but I’d rather be as thorough as possible):

  1. Go to the text page
  2. Right click > Select all (or alternatively press Ctrl+A)
  3. Right click > Copy (or Ctrl + C)
  4. Open Notepad
  5. Right click > Paste (or Ctrl + V)

So you end up with something like:

  1. Click File > Save (or Ctrl + S)
  2. Choose where you want to save it
  3. Overwrite the name with either “ChickenLauncher.hex” or “ChickenLauncher.ino” depending on which file you’ve picked (.ino might be easier since it seems you’ve compiled with the IDE before)
  4. Make sure to select “All Files” from the dropdown menu, like so:

  1. Click Save

Then you should have the file and I’m assuming you know what to do from there.


#16

I figured I could do that, but I’d rather not break things. Thanks for helping me out.


(Pharap) #17

You should be safe as long as you don’t accidentally bits of the text after pasting.
If you choose the .ino file then the worst case scenario is probably the code not compiling.
The .hex would be more of an issue since you might not find out you’re missing bits of code until part way through the game.

No problem, helping with people’s issues is one of the reasons the forums exist.