This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Redstoner's profile picture

[Whack a Pig][AlphanumericAPI]

Started by Redstoner, 24 March 2014 - 09:10 AM
Redstoner #1
Posted 24 March 2014 - 10:10 AM
Whack a Pig
I have been working on a small game over the past few days, and I now feel its in a condition to release. The game is Whack a Pig. It is a recreation of the game Whack a Mole. I have brought a Minecraft feel to it by adding some of the mobs that we all know and love and giving them abilities to make the game more interesting.

I have done quite a bit of testing on this, however there is always the possibilities of bugs. If you run into any, please let me know in the comments below. It really helps if your are descriptive with your bug reports. Please let me know as much as you can about what cause the issue. I will try to fix bugs as soon as possible, and plan to add new features to this very soon. So keep an eye out for updates on this. Also if you have any suggestions for gamemodes, mobs, anything else, leave a comment. Hope you enjoy the game.

Install Instructions -
[indent=1]Easy Method -[/indent]
[indent=2]Enable http in CC config[/indent]
[indent=2]run pastebin get qs4R58zL pig[/indent]
[indent=1]Complex Method -[/indent]
[indent=2]download the script from pastebin - http://pastebin.com/qs4R58zL[/indent]
[indent=2]save to CC computer as "pig"[/indent]
[indent=2]get the alphanumeric API (see below)[/indent]

[indent=1]Optional Steps -[/indent]
[indent=2]Enable commandblocks in CC config for sounds and attach command block to computer.[/indent]
[indent=2]Attach a monitor to any side of the computer.[/indent]

Features:
  • Optimized to reduce flickering
  • 2 Game modes
  • Top 10 Scores for each gamemode
  • Optional Sounds with commandblocks
  • Stat Tracking with optional monitor
  • Special Mobs with abilities
  • Built In Help Command
Coming Soon:
  • More Sounds
  • More Mobs
  • Multiplayer
  • New Gamemodes
  • New Scenery
Screenshots:
Spoiler

Changelog:
Spoiler
  • 1.0.2 - qs4R58zL - 3/27
    • Added hit streak statistic
    • Lose condition for Endurance Mode
      • You now start with 20 HP, and lose one HP for each mob you miss or miss click
      • You can regain HP by maintaining a hit streak of more than 15
      • Added HP meter
    • Bonus multiplier for hit streaks in Speed Runs
      • 2x Hits at 25 Streak
      • 3x Hits at 50 Streak
      • Increased Goal to 250 to make more of a challenge.
      • Added Bonus Streak meter
        • shows multiplier below it
    • Better Background Images
    • 2 New Mobs
      • Cow - Changes Background to Grass Theme
      • Mooshroom - Changes Background to Mycelium
    • Pigmen no longer add to misses in stats
    • Fixed pigmen not actually killing mobs completely
    • added version to main menu
    • fixed bug when clicking on mole position before any moles spawned
    • Cleaned up endermen bonus round bugs
      • Endermen round can now add or remove points depending on your accuracy
      • Max win/lose = 100 * Difficulty
    • Fixed slow timers
      • Time seems to run at 2x speed in beta builds
      • Re adjusted life timers for change in time.
        • Should be more difficult!
  • 1.0.1 - XzisQu7S - 3/24
    • Fix for api dl which prevented game from working
    • compatible with older versions of cc
    • added reset command to clear scores files
    • more code comments
    • added version to main menu Missed it in upload somehow.
  • 1.0 - fYmT0fhf - 3/23
    • Initial Release
    • alphanumeric API released
      • FcbUaCvM
Alphanumeric API
This is a small API that I created to allow a developer to easily create large 5x5 characters without having to change text size. I have used this in my Whack a Mole game for things such as the title and score. More info can be obtained in game using the command "alphanumeric help".

The API currently only has 2 functions -

[indent=1]stringToImg(string,color,startX,startY)[/indent]
[indent=1]charToImg(char,color,startX,startY)[/indent]

Install Instructions -

[indent=1]Easy Method -[/indent]
[indent=2]Enable http in CC config[/indent]
[indent=2]run pastebin get alphanumeric[/indent]
[indent=1]Complex Method -[/indent]
[indent=2]download the script from pastebin - http://pastebin.com/FcbUaCvM[/indent]
[indent=2]save to CC computer as "alphanumeric"[/indent]

Features
  • line wrapping
  • all characters supported on a standard qwerty keyboard
  • built in help
*Note - Alphanumeric API cannot print lowercase characters yet. "Phrase" is the same as "pHrASe".
Edited on 27 March 2014 - 05:35 AM
unobtanium #2
Posted 24 March 2014 - 11:39 AM
Wow nice :D/>

I took a fast look at the code and wonder why you didnt used two-dimensional arrays for the images?
theoriginalbit #3
Posted 24 March 2014 - 11:45 AM
I took a fast look at the code and wonder why you didnt used two-dimensional arrays for the images?
Ummm… they are 2D arrays!
OReezy #4
Posted 24 March 2014 - 08:46 PM
Found some bugs for you.

Line 219:
download("http://pastebin.com/FcbUaCvM",alphanumeric)
Needs to be
download("http://pastebin.com/raw.php?i=FcbUaCvM","alphanumeric")
1. alphanumeric needed to be a string 2. the url needs to get the raw paste else it gets the code of the website too which messes up the api.

Line 1185:
home = term.current()
Had to comment this out because it is nil. I'm using ComputerCraft v1.57.

Overall it is a pretty fun game. I do have a couple suggestions though. For speed mode you could have a point multiplier at certain amount of hits without any misclicks or letting a pig sneak by. And for endurance mode have "lives" that you lose if you misclick or let a pig sneak by instead of it just being forever.
Redstoner #5
Posted 24 March 2014 - 09:49 PM
ahh, yes. Thank you. I will fix those issues. the home = line should have been removed a while back, i must've missed that when doing the update to the peripheral code.
I will see what I can do with the suggestions too. I think the idea of lives in endurance mode could definitely work out.
Agoldfish #6
Posted 24 March 2014 - 09:59 PM
This kinda reminds me of that tile game where you have to slide the tiles to make a picture.
Redstoner #7
Posted 27 March 2014 - 06:37 AM
New Update out. Too many changes to list here. (See changelog) Should make the game more challenging and interesting. I have added a lot to this version, and may have missed a few things. If you find any bugs, please let me know so I can squash em.

Also added something secret. Can you find it without digging in the code for it? Please don't spoil it for others.
Edited on 27 March 2014 - 05:40 AM