Long time lurker (many many years..), 1st time poster!..
I am working on an idea for a game, based on the old BBC Micro pack in title "Yellow River Kingdom". It's a game I always thought the 2600 could do and there have been many clones on other platforms. Probably not a great choice for my first effort at coding a game on the 2600, but I figured it being less "arcadey" would be easier. Oh how wrong could I be
I've programmed before (ZX Spectrum, BBC Basic, Commodore Basic) so the structures and concepts in Batari Basic are reasonably familiar. I even dabbled with Z80 assembler around 20 years ago.
I'll explain my game idea summary and then the problem I'm wrestling with:
Game Summary :
- DPC+ kernel, idea is to use the keypad for input (open to suggestions but this seems to work in concept as user input is solely numeric)
- You are the ruler of a village between a river and mountain range.
- The game is split in to Years, each year has 4 seasons (turns).
- For each season the leader has to decicde how many of the people in the villiage to assign to 3 principle tasks
- Guard the village from the bandits in the mountains
- Repair and maintain the Dyke so it doesn't flood the villiage and crop fields.
- Plant and gather crops and fish from the river.
- After each season's selections, the logic processes the choices and a cut scene is displayed showing the outcome (bandit raid successful, bandit raid defeated, dyke leaks, etc), followed by a summary showing losses and gains.
- Repeat to next season / year until there is no one left or a set of as yet undetermined win conditions are met.
I've been testing out playfield and flow / structure ideas using the DPC+ kernel. My idea is for each element to be broken out to a new "screen". Screen 1 is the input screen, screen 2 in the results cut scene, screen 3 is the results display etc. I don't have much working code to share yet as a lot of my work so far has been with pencil and paper and stand alone sections don't do much yet. (It was great fun experimenting with the title mini kernel though and getting that working).
I hit a brick wall that I've been banging my head against for a few days :
How do I get the input from the user on to the screen.
The input screen is split into 4 sections, 1 sections shows total number of people in the village, 2nd shows the number for guard duty, 3rd shows the number set for food production, 4th shows the number set for maintaining the dyke.
My idea was to have a variable that holds the number of "people" and variables for each function that needs people assigned, to illustrate my babbling, i'll call them "_totalpeople", "_guard", "_crops", "_dyke"
_totalpeople = 125
So now I need to allow the user to select some of those to guard the village.(my idea is to use the keypad for input maybe adapting the excellent examples here http://atariage.com/...i-basic/page-2)
My idea was to use sprites to represent user input (numbers) on the screen in the absence of any other easy way to represent alpha-numerics on the screen easily (if there is a way i've overlooked, i'm all ears!)
So the user types 40 on the keypad followed by * (for enter) and on the screen it will display "40" in "Guard" area and set the guard variable to 40.
_guard = 40
and so on.
where I am struggling is how to translate 40 which would be stored, probably in the score for showing the input into the _guard variable (so it can be used in the logic) and then into 3 component numbers (a "0", a "4" and a "0") so I can call the sprites to represent those numbers on the screen in the right area.
I can't figure out how to get the number input (as shown by keypad to score here by CurtisP : http://atariage.com/forums/topic/105865-keypads-and-batari-basic/page-2) fromthe score to my variable and then split the variable into hundreds, tens and units so i can code up a check to then place the relevant sprite detail for the digit..
Putting the input considerations aside, splitting the variable seems to be my biggest headache, I just can't get anything to work.
I looked at masking but I must admit, while I understand the principle, I couldn't get it to work. (I read through the two threads I found on here)
I don't want to abandon what could be a really interesting project but right now I'm pretty stumped and feel like I've bitten off a bit more than I can chew.
I can't figure out out how input and store a number (keypad most likely - open to other suggestions) and then split that stored number into individual digits for the purpose of displaying it using sprites / other method on the screen.
Any suggestions or pointers would be appreciated.
(Sorry for the long winded post, but I hope the context helps)