Multiple Endings to your game

Post Reply
Gilbertmaxter
Posts: 100
Joined: Tue Oct 16, 2018 3:04 am

Multiple Endings to your game

Post by Gilbertmaxter » Thu Sep 12, 2019 3:05 am

Hello everyone,

If your like me and love story's you want multiple endings on your games.

I know I do as my game has a bit of story.

I wanted to share my multiple endings script to the game. I use 4 constants and 1 variable.

Variable

endingScene

the initial value is 0.


the four constants are
END_1
END_2
END_3
END_4

you can use which ever constant value you want as these will warp you to the screen

I use the values 250-253

now I use 2 scripts and I set them up as AI Scripts. But you can likely set them up as other things.

Script 1 just increases the value of the variable endingScene

Code: Select all

  
   ;; Ending Mode
  LDA endingScene 
  CLC
  CMP #$03
  BCS +
  INC endingScene
  +
 
Script 2 does most of the work as it checks what the value of the ending scene is. and then warps the user to screen depending on the option. I use this to setup different cutscenes
that way my game has some variety. Also to note I made my ending start in the over-world if you want to use the underworld just comment the over-world section and then un-comment the overworld Section.

Code: Select all

	;; possible endings
	;; 1:  no Saving the day - Default
	;; 2: you sorta save the day
	;; 3: you mostly save the day
	;; 4: you save the day (<-- the Max Ending)
	
	LDA endingScene 
	CLC
	CMP #$01
	BNE +
	;; if Ending 2:
	LDA #END_2
	STA tempz
	JMP ++
	+
	CMP #$02
	BNE +
	;; if Ending 3:
	LDA #END_3
	STA tempz
	JMP ++
	+
	CMP #$03
	BNE +
	;; if Ending 4:
	LDA #END_4
	STA tempz
	JMP ++
	+
	;;ELSE:
	;; default Ending:
	LDA #END_1
	STA tempz
	++ 
	
	;; warp to Ending:
	LDA tempz
	STA warpToScreen
	
	;;goes to the over-world
	GoToScreen warpToScreen, #$01, #$02
	
	;;goes to the under-world
	;;GoToScreen warpToScreen, #$02, #$02
	
	LDA #$00
	STA playerToSpawn
	
	LDA #$01
	STA loadObjectFlag
	
	JSR DeactivateAllObjects
	
	RTS
thank you and let me know what you think :)
User avatar
dale_coop
Posts: 4100
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Multiple Endings to your game

Post by dale_coop » Thu Sep 12, 2019 11:31 am

Awesome! Great script and useful! Thanks for sharing it, Gilbertmaxter <3
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
Gilbertmaxter
Posts: 100
Joined: Tue Oct 16, 2018 3:04 am

Re: Multiple Endings to your game

Post by Gilbertmaxter » Thu Sep 12, 2019 11:33 am

Ty dale hope it helps :)
Post Reply