TurtleRescueNES
Active member
In the above clip, you'll notice two things. First, the monsters spawn a point value that rises upon defeat. Second, different monsters generate different point values and the appropriate values are added to the player's score. Simple stuff, right? Well, none of that was delivered out of the box with the NESmaker adventure and platforming modules. But now you can add this feature to your game with the following steps.
Step 1: GAME OBJECT TILES
Open your GameObjectTiles.bmp. You will need 8 tiles to store your points.
One tile should house "00". The other seven should house the numbers "1" through "7".
See image below for sample styles. Try creating your own look, but follow this structure.
STEP 2: CUSTOM AI SCRIPT
You will need a dedicated AI Script that makes the points always move up.
The script is as easy as this:
LDA #%00100000
STA Object_movement,x
STEP 3: POINTS GAME OBJECT SETUP
Pick a Game Object to represent your point values. You only need one.
We will create code later that tells this singular object to display one of eight possible results. In my case, the points object is tenth in the list, so starting my count with zero, this is object number nine. Make note of this object number for later.
Your object should be one tile high and two tiles wide.
STEP 4: OBJECT ANIMATIONS
Click on Manage Animations. Create eight animations. Call them:
Points100
Points200
Points300
Points400
Points500
Points600
Points700
NoPoints
Within each animation, assign the appropriate graphic tiles to match the names of the animations you created. Note that for "NoPoints" you want to assign a blank tile. Each animation only requires one frame each.
STEP 5: OBJECT DETAILS - ANIMATIONS
Click on Object Details button. Create eight Animation Types. Call them:
100
200
300
400
500
600
700
NoPoints
Assign the appropriate Animations to each Type's directional movement.
Points will always move up, but to be safe, make them all match.
STEP 6: OBJECT DETAILS - DETAILS
Set both Normal Max Speed and Acceleration Speed to 16
All other settings should be defaults or unclicked.
STEP 7: OBJECT DETAILS - ACTIONS
You will utilize all eight action steps. They must be set up on the following order:
Action Step 0: Animation Type = NoPoints; Action = 0-Null; Timer = 0; EndAction = DestroyMe; EndAnimation = DestroyMe
Action Step 1: Animation Type = 100; Action = Move Up (Points); Timer = 2; EndAction = DestroyMe; EndAnimation = Loop
Action Step 2: Animation Type = 200; Action = Move Up (Points); Timer = 2; EndAction = DestroyMe; EndAnimation = Loop
Action Step 3: Animation Type = 300; Action = Move Up (Points); Timer = 2; EndAction = DestroyMe; EndAnimation = Loop
Action Step 4: Animation Type = 400; Action = Move Up (Points); Timer = 2; EndAction = DestroyMe; EndAnimation = Loop
Action Step 5: Animation Type = 500; Action = Move Up (Points); Timer = 2; EndAction = DestroyMe; EndAnimation = Loop
Action Step 6: Animation Type = 600; Action = Move Up (Points); Timer = 2; EndAction = DestroyMe; EndAnimation = Loop
Action Step 7: Animation Type = 700; Action = Move Up (Points); Timer = 2; EndAction = DestroyMe; EndAnimation = Loop
No animation speeds nor settings need to be checked for these action steps.
No bounding box needs to be set.
STEP 8: PROJECT SETTINGS
From the menu, select Project > Project Settings
Click on the User Variables tab
Create a variable called "varTempPoints" with a default value of 0
Click on User Constants tab
Create a constant called "#OBJ_MONSTER_DEATH" that contains the value of the Game Object you created to house the points. In my case, it was the ninth object so I have 9. Remember to start your count with zero.
STEP 9: CUSTOM CODE - HANDLE DROPS
Now we get to customize our game's code. Important: Your game may vary based on your base module and/or any customizing you may have done up to this point. We're not changing a whole lot, but still proceed with caution! Back up your scripts or comment out old code to easily restore it.
Open Scripts > Defined Scripts
Locate "Handle Drops" script
Locate the label "donePickup:"
Directly beneath that, alter/add the following code:
CreateObject temp, temp1, #OBJ_MONSTER_DEATH, #varTempPoints
What did we do? This code originally created the little poof effect when a monster is defeated.
Instead, we are calling the points object. The varTempPoints tells the points object which action state to display, from zero to eight. Remember, we defaulted that variable to zero, so nothing should actually appear yet.
STEP 10: CUSTOM CODE - HANDLE MONSTER HURT
Locate "Handle Monster Hurt" script
Locate the label "skipRecoilBecauseOnEdge:"
Move down to the macro "DeactivateCurrentObject"
Directly beneath that, you will need to replace the scoring code with the following:
LDY Object_type,x
LDA ObjectWorth,y
STA varTempPoints
AddValue #$06, myScore, varTempPoints, #$02
What did we do? This code is called when the monster is destroyed and is supposed to increment your score. In this case it wants to increment the score in the hundreds place with the value of varTempPoints. We defaulted that variable to zero, but this code is overwriting that value with the contents of "ObjectWorth". What's that, you say? This is the fun part!
STEP 11: ASSIGN POINT VALUES TO YOUR MONSTERS!
Open up one of your monster's Object Details
Click on Details tab
Look at the Experience setting. Experience defaults to 0, and before the above code was added, monster experience values were never utilized. You can now set each of your monster's experience to a value from 0 to 7. 0 represents no points/no action, 1 represents 100 points, 2 represents 200 points and so on...
CONGRATULATIONS!
You now have a variable scoring system in place that behaves similarly to many of the classic games of the 80s and 90s! There is a known limitation with this setup in that you cannot go higher than 700 points, but maybe someone can improve upon this approach.
Happy gaming!
Joe
"Turtle Rescue"