(4.5.9) Extra Lives Tiles, Game Over and Continues!

dale_coop

Moderator
Staff member
sure in the Predraw (or postdraw, depends where you put your drawsprite code), just do:
Code:
LDA gamepad
AND #%00000001 ;; button "A"
BEQ +notPressed
    ;; here put your DrawSprite code
+notPressed:

Code:
; gamepad bits:
;  7 - 6 - 5 - 4 - 3 - 2 - 1 - 0
;  |   |   |   |   |   |   |   + -- A
;  |   |   |   |   |   |   +------- B
;  |   |   |   |   |   + ---------- Select
;  |   |   |   |   +--------------- Start
;  |   |   |   +------------------- Up
;  |   |   +----------------------- Down
;  |   + -------------------------- Left
;  +------------------------------- Right
 

NightMusic

Member
sure in the Predraw (or postdraw, depends where you put your drawsprite code), just do:
Code:
LDA gamepad
AND #%00000001 ;; button "A"
BEQ +notPressed
    ;; here put your DrawSprite code
+notPressed:

Code:
; gamepad bits:
;  7 - 6 - 5 - 4 - 3 - 2 - 1 - 0
;  |   |   |   |   |   |   |   + -- A
;  |   |   |   |   |   |   +------- B
;  |   |   |   |   |   + ---------- Select
;  |   |   |   |   +--------------- Start
;  |   |   |   +------------------- Up
;  |   |   +----------------------- Down
;  |   + -------------------------- Left
;  +------------------------------- Right
Thank you . I'll clean up the code. :) have a great cup of coffee and a great weekend.
 

NightMusic

Member
Alright I got this now Thank you @dale_coop :)

I made a video :
(addendum : I modified my SelectionStartGame script AFTER the video and am including it now...)
The Selection Script is used so you can use up down or left or right to select your options... not select button (that increases continues)

Code:
checkSelection:
    TXA
    STA tempx
    LDA gamepad
    AND #%11110000
    BNE continueCheckingSelection
    JMP endCheckingSelection

continueCheckingSelection:
    LDA gamepad
    AND #%00010000
    BNE selectionUp
    LDA gamepad
    AND #%00100000
    BNE selectionDown
    LDA gamepad
    AND #%10000000
    BNE selectionLeft
    LDA gamepad
    AND #%01000000
    BNE selectionRight
    JMP endCheckingSelection

selectionUp:

    LDA curSelection
    BNE +
    LDA #SELECTION_MAX_VALUE    ;; <-- the max value of curSelection
    STA curSelection
    JMP ++
    +
    DEC curSelection
    ++
    JMP endCheckingSelection
   
selectionDown:

    LDA curSelection
    CMP #SELECTION_MAX_VALUE    ;; <-- the max value of curSelection
    BNE +
    LDA #$00
    STA curSelection
    JMP ++
    +
    INC curSelection
    ++
    JMP endCheckingSelection
   
selectionLeft:
    JMP selectionDown

selectionRight:
    JMP selectionUp
   
endCheckingSelection:

    LDA gameState
    CMP #4                ;; Is this Character Select Screen? ;;
    BNE +notSelect
        LDA charSelect
        BNE +
    INC charSelect
        JMP +notSelect
+
    DEC charSelect

;;;;;;;;;;;;;;;;;;;;
    ;; OR DO THIS ;;
;;    LDA #$00
;;    STA charSelect
;;;;;;;;;;;;;;;;;;;;

+notSelect
    LDX tempx
    RTS

Now we need to assign our inputs in Input Editor to not have any references to the select button .. remove them now.
Then add selection for left and right on the character select and make sure on your start screen you have for up own (if you're following my videos)

Next theres the SpritePostDraw : This has the CREDIT letters from previous video predraw script, so if your predraw script has :

Code:
;; DRAWS "CREDIT" AT BOTTOM OF EVERY SCREEN ;;

;; C ;;
DrawSprite #$B1, #$E0, #112, #%00000000, #$00
;; R ;;
DrawSprite #$B9, #$E0, #113, #%00000000, #$00
;; E ;;
DrawSprite #$C1, #$E0, #114, #%00000000, #$00
;; D ;;
DrawSprite #$C9, #$E0, #115, #%00000000, #$00
;; I ;;
DrawSprite #$D1, #$E0, #116, #%00000000, #$00
;; T ;;
DrawSprite #$D9, #$E0, #117, #%00000000, #$00

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

cut that out.... now use my script here :

Code:
;; DRAWS "CREDIT" AT BOTTOM OF EVERY SCREEN ;;

;; C ;;
DrawSprite #$B1, #$E0, #112, #%00000000, #$00
;; R ;;
DrawSprite #$B9, #$E0, #113, #%00000000, #$00
;; E ;;
DrawSprite #$C1, #$E0, #114, #%00000000, #$00
;; D ;;
DrawSprite #$C9, #$E0, #115, #%00000000, #$00
;; I ;;
DrawSprite #$D1, #$E0, #116, #%00000000, #$00
;; T ;;
DrawSprite #$D9, #$E0, #117, #%00000000, #$00

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; DRAWS YOUR CREDIT NUMBER from myContinues variable AT BOTTOM OF EVERY SCREEN ;;

LDA gamepad
AND #%00000100 ;; button "SELECT"
BNE +isPressed

        JMP +doneAdding

+isPressed
 
     LDA myContinues
    CMP #$09
    BNE +addContinue
        JMP +doneAdding

 +addContinue

    INC myContinues
;    UpdateHudElement #$05   ;; change this to which element shows myContinues. ;;
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
    JSR doWaitFrame
+doneAdding

 ;; here put your DrawSprite code
    LDA myContinues
    CMP #$09
    BNE +drawNumber8
        DrawSprite #$E5, #$E0, #126, #%00000000, #$00
        JMP +notPressed
+drawNumber8
    CMP #$08
    BNE +drawNumber7
        DrawSprite #$E5, #$E0, #125, #%00000000, #$00
        JMP +notPressed
+drawNumber7
    CMP #$07
    BNE +drawNumber6
        DrawSprite #$E5, #$E0, #124, #%00000000, #$00
        JMP +notPressed
+drawNumber6
    CMP #$06
    BNE +drawNumber5
        DrawSprite #$E5, #$E0, #123, #%00000000, #$00
        JMP +notPressed
+drawNumber5
    CMP #$05
    BNE +drawNumber4
        DrawSprite #$E5, #$E0, #122, #%00000000, #$00
        JMP +notPressed
+drawNumber4
    CMP #$04
    BNE +drawNumber3
        DrawSprite #$E5, #$E0, #121, #%00000000, #$00
        JMP +notPressed
+drawNumber3
    CMP #$03
    BNE +drawNumber2
        DrawSprite #$E5, #$E0, #120, #%00000000, #$00
        JMP +notPressed
+drawNumber2
    CMP #$02
    BNE +drawNumber1
        DrawSprite #$E5, #$E0, #119, #%00000000, #$00
        JMP +notPressed
+drawNumber1
    CMP #$01
    BNE +drawNumber0
        DrawSprite #$E5, #$E0, #118, #%00000000, #$00
        JMP +notPressed
+drawNumber0
        DrawSprite #$E5, #$E0, #111, #%00000000, #$00
        JMP +notPressed

+notPressed:
    RTS

Then...
Watch this video for anything else you need...

View: https://youtu.be/rGAgulMSC8w
 
Last edited:
Top Bottom