Get out of start screen/Learning the Macros

Having trouble compiling code? Getting an unexpected error? Player not appearing on screen? Seeking answers on how to do a particular thing? This is the forum you're looking for, to ask other NESmaker users for assistance.
Post Reply
Primkinkajou
Posts: 6
Joined: Fri Jan 11, 2019 8:39 am

Get out of start screen/Learning the Macros

Post by Primkinkajou » Fri Jan 11, 2019 9:29 am

Hey, I'm new here. Nice to meet all of you. Anyways, I'm having a slight problem when starting to create scripts. In the scrolling platformer module I was trying to make a simple script so that when I pressed the start button I would warp to my first level. I got it to work by stealing code from the "warp tile" (which took forever btw), but my player didn't spawn in where I placed him in the overworld editor. At this point my code looked like this:

Code: Select all

GoToScreen #$00, #$01, #$03
RTS
So i figured that maybe I needed to change the gamestate to get it to spawn. I altered my code until it appeared something like this:

Code: Select all

LDA #$00
STA newGameState
GoToScreen #$00, #$01, #$03
RTS
But that still didn't do it. So i turned to the fat list of macros on the side of the "defined scripts" menu. I found the "CreateObject" macro and browsed this site for a way to use it until I came up with this:

Code: Select all

LDA #$00
STA newGameState
GoToScreen #$00, #$01, #$03
LDA playerToSpawn
CreateObject newX, newY, playerToSpawn, #$00, currentNametable
RTS
This spawns my player, but spawns him offscreen so I get warped to an unintended area. I tried putting values into newX and newY such as #$90 and #$d0 becuase I wanted it on the tile (9, 13) but to no avail.

Any help is appreciated on this problem, but I like to teach a man to fish rather than give him a fish, so if you have resources on how I could look at to learn how to use this codebase and documentation on the various macros and constants used, I would love to see them so maybe in the future I can fix my own problems. Until then I'm turning to you guys, and am eternally grateful for your support.
User avatar
dale_coop
Posts: 2092
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Get out of start screen/Learning the Macros

Post by dale_coop » Fri Jan 11, 2019 11:09 am

I am not sure to understand what you want to do, here...
If you want a script to go away from the start screen, and start your game (to the screen where you placed your Player)... you need to call this script: "GameEngineData\Routines\Basic\ModuleScripts\InputScripts\startGame.asm"

Code: Select all

  LDA #STATE_START_GAME
  STA change_state
  
  ;StopSound
  ;PlaySound #$00, $00

  LDA #%10000000
  STA gameHandler ;; turn sprites on
  RTS
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Primkinkajou
Posts: 6
Joined: Fri Jan 11, 2019 8:39 am

Re: Get out of start screen/Learning the Macros

Post by Primkinkajou » Fri Jan 11, 2019 6:22 pm

Ok, awesome! I had no idea that this script existed. Thanks so much!
User avatar
dale_coop
Posts: 2092
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Get out of start screen/Learning the Macros

Post by dale_coop » Fri Jan 11, 2019 7:23 pm

In fact there are a lot of scripts in the folders/subfolders... you have the be curious, try to guess what they do, and try some... (some are updated and work, some are outdated or not finished or broken)
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE
Post Reply