![](https://i0.wp.com/board-b.com/wp-content/uploads/2024/06/PickupObject.png?resize=512%2C480&ssl=1)
Setting Up a Pickup Object
Making Something Happen
Making a pickup object in NESmaker only requires a few steps. Keep in mind that objects in different modules need to be slightly different, depending on if there is gravity in the module or not. All platform game modules (MetroVania, LR Platformer and Arcade Platformer) have gravity.
Setting Up a Pickup Object
1. Choose a free Game Object from the list in the Context Menu on the left. Remember that most objects here don’t have any meaning in the code, despite their names in the list. In this case I will choose the Game Object labeled Currency Pickup.
![](https://i0.wp.com/board-b.com/wp-content/uploads/2024/06/PickupObject1.png?resize=625%2C388&ssl=1)
2. Click the Object Details button and go to the Details tab. Make sure pickup / powerup is checked. If this is a platform game (where we have gravity), then you also need to make sure that Solid Object Reaction is set to Stop.
![](https://i0.wp.com/board-b.com/wp-content/uploads/2024/06/PickupObject2.png?resize=625%2C332&ssl=1)
3. Then go to the Bounding Box tab and set the size of the collision for this object. I recommend covering the entire graphic.
![](https://i0.wp.com/board-b.com/wp-content/uploads/2024/06/PickupObject3.png?resize=625%2C332&ssl=1)
Close the Object Details window and you’re done.
Making Something Happen
Now we have the pickup object set up, and if you also have a monster group set to a screen, then we can place our pickup object on the screen (in the Screen Editor) by right clicking anywhere and select Place Monster 1, 2, 3 or 4. However, most likely nothing is going to happen when we pickup the object in the game. That’s because we haven’t written any code to handle this pickup. In order to do that we need to edit the pickup script.
1. Start by opening the Project Settings window.
![](https://i0.wp.com/board-b.com/wp-content/uploads/2024/06/ProjectSettingsButton.png?resize=502%2C390&ssl=1)
2. Go to the Script Settings tab and scroll down till you see the folder icon named Game. Find and select the line that says Pickup Script. Click the Edit button on the top.
![](https://i0.wp.com/board-b.com/wp-content/uploads/2024/06/PickupScript.png?resize=625%2C261&ssl=1)
This will open the pickup script in your code editor, like for example Notepad++.
Here is an example file that shows what happens when we pick up Game Objects 4, 5, 6 and 7. If you are new to Assembly programming it’s most important that you focus on understanding the concepts rather than the code itself.
The first thing that happens in the code is LDA Object_type,x. This code is triggered by the pickup object itself, so the object ID for that object is loaded into X now. That means we check what object number this is (in the Game Objects list), starting to count from the player (which is Game Object 0) at the top. Since I made my pickup object in Game Object 7, the code that will run in this case is AddValue #6, myMoney, #1, #1, which will add 100 to myMoney. If this was Game Object 4, then the code for the Health Pickup would be run instead (see below).
;;; Pickup script.
;;; Right now, we need to look at the type of object that is in X.
;;; Then, we have to do pickup behavior accordingly.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;What object is your pickup? 0 - 15
LDA Object_type,x
CMP #4 ;;; Health Pickup (Game Object 4)
BNE +notThisPickup
LDA myHealth
CMP myMaxHealth
BCS +noMoreHealth
INC myHealth
+noMoreHealth:
JMP +endPickups
+notThisPickup:
CMP #5 ;;; Charge Pickup (Game Object 5)
BNE +notThisPickup
LDA myAmmo
CMP #5 ;;; Max ammo
BCS +noMoreAmmo
INC myAmmo
+noMoreAmmo:
JMP +endPickups
+notThisPickup:
CMP #6 ;;; Key Pickup (Game Object 6)
BNE +notThisPickup
LDA myKeys
CMP #9 ;;; Max keys
BCS +noMoreKeys
INC myKeys
+noMoreKeys:
JMP +endPickups
+notThisPickup:
CMP #7 ;;; Currency Pickup (Game Object 7)
BNE +notThisPickup
AddValue #6, myMoney, #1, #1
;arg0 = how many places this value has.
;arg1 = home variable
;arg2 = amount to add
;arg3 = what place value is receiving the addition?
;;; 0 = ones place, 1 = tens place, 2 = hundreds place, etc.
JMP +endPickups
+notThisPickup:
+endPickups
;;; Object will already destroy based on type.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Creating and editing scripts like this takes practice, and you also need to be familiar with how NESmaker works in order to make the script you want. If this feels complicated and difficult I recommend asking for help on the NESmaker forum. There are a lot of friendly and helpful people who can assist you there.