Get out of start screen/Learning the Macros

Primkinkajou

New member
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:
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:
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:
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.
 

dale_coop

Moderator
Staff member
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:
  LDA #STATE_START_GAME
  STA change_state
  
  ;StopSound
  ;PlaySound #$00, $00

  LDA #%10000000
  STA gameHandler ;; turn sprites on
  RTS
 

dale_coop

Moderator
Staff member
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)
 
Top Bottom