How to make game speed up as score increases? (4.5.9)

Like it says in the title, I am trying to find out how to make the game speed up each time a specific score milestone is achieved (like, speed up at 2000 points, speed up at 5000, etc.). Kind of like how Tetris works. how would I go about doing this? This is one of the last touches I need before submitting my Byte-Off entry
 

smilehero65

Active member
Like it says in the title, I am trying to find out how to make the game speed up each time a specific score milestone is achieved (like, speed up at 2000 points, speed up at 5000, etc.). Kind of like how Tetris works. how would I go about doing this? This is one of the last touches I need before submitting my Byte-Off entry
I think I have an answer
  1. Create a variable called MyLevel, initialize it in 0 or 1
  2. Go to your Physics Script
  3. Go to the line that looks like this:
Code:
        LDY Object_type,x
        LDA ObjectMaxSpeed,y
        ASL
        ASL
        ASL
        ASL
        ;AND #%00001111
        STA myMaxSpeed
        LDA ObjectMaxSpeed,y
        LSR
        LSR
        LSR
        LSR
        STA myMaxSpeed+1

4. Replace the lines with these:

Code:
LDY Object_type,x
        LDA ObjectMaxSpeed,y ;;;Load Max Speed
        ADC myLevel         ;;;;;;;Add Max Speed to the value of myLevel
        STA tempA
        
        LDA tempA
        ASL
        ASL
        ASL
        ASL
        ;AND #%00001111
        STA myMaxSpeed
        LDA tempA
        LSR
        LSR
        LSR
        LSR
        STA myMaxSpeed+1

5. Now you just need to select when to increase the value of MyLevel

I think it should be good.
I didn't test this, so please let me know if anything arises.

Side Note - this code is based on Dale Coop's Holding B to Run

 
I think I have an answer
  1. Create a variable called MyLevel, initialize it in 0 or 1
  2. Go to your Physics Script
  3. Go to the line that looks like this:
Code:
        LDY Object_type,x
        LDA ObjectMaxSpeed,y
        ASL
        ASL
        ASL
        ASL
        ;AND #%00001111
        STA myMaxSpeed
        LDA ObjectMaxSpeed,y
        LSR
        LSR
        LSR
        LSR
        STA myMaxSpeed+1

4. Replace the lines with these:

Code:
LDY Object_type,x
        LDA ObjectMaxSpeed,y ;;;Load Max Speed
        ADC myLevel         ;;;;;;;Add Max Speed to the value of myLevel
        STA tempA
       
        LDA tempA
        ASL
        ASL
        ASL
        ASL
        ;AND #%00001111
        STA myMaxSpeed
        LDA tempA
        LSR
        LSR
        LSR
        LSR
        STA myMaxSpeed+1

5. Now you just need to select when to increase the value of MyLevel

I think it should be good.
I didn't test this, so please let me know if anything arises.

Side Note - this code is based on Dale Coop's Holding B to Run


For some reason, after doing that the score isn't increasing right. Any time I add a new variable it seems to mess something up and I'm not sure why. I updated the ROM in Google Drive if you want to see for yourself
 
After a quick test, the error only occurs if the following code is applied to the Monster Hurt script:
Code:
LDA myScore
            CMP #$2000
            BEQ +levelup
            JMP +nextlevel
            +levelup
            INC myLevel
            
            +nextlevel
            CMP #$5000
            BEQ +levelup1
            JMP +nextlevel1
            +levelup1
            INC myLevel
            
            +nextlevel1
            CMP #$7500
            BEQ +levelup2
            JMP +endlevel
            +levelup2
            INC myLevel
            
            +endlevel
 

smilehero65

Active member
After a quick test, the error only occurs if the following code is applied to the Monster Hurt script:
Code:
LDA myScore
            CMP #$2000
            BEQ +levelup
            JMP +nextlevel
            +levelup
            INC myLevel
          
            +nextlevel
            CMP #$5000
            BEQ +levelup1
            JMP +nextlevel1
            +levelup1
            INC myLevel
          
            +nextlevel1
            CMP #$7500
            BEQ +levelup2
            JMP +endlevel
            +levelup2
            INC myLevel
          
            +endlevel
I see the issue
There is no such thing as a #$2000 in hexadecimal.

The minimum hex is #$00, the max is #$FF (255)
The way you check score code is through the myScore_00X whatever variables.
The game checks for the leader number of the zeroes.

To check if your score is 2,000, I think you should do it this way:
Code:
LDA myScore_0000
CMP #2

The same could go for 5,000
Code:
LDA myScore_0000
CMP #5

Or if you would want to check for, let's say... 60,000, then it should be:
Code:
LDA myScore_00000
CMP #6

It is not a very easy concept (I don't think I explained myself well lol)
Hope it helps!
 
I see the issue
There is no such thing as a #$2000 in hexadecimal.

The minimum hex is #$00, the max is #$FF (255)
The way you check score code is through the myScore_00X whatever variables.
The game checks for the leader number of the zeroes.

To check if your score is 2,000, I think you should do it this way:
Code:
LDA myScore_0000
CMP #2

The same could go for 5,000
Code:
LDA myScore_0000
CMP #5

Or if you would want to check for, let's say... 60,000, then it should be:
Code:
LDA myScore_00000
CMP #6

It is not a very easy concept (I don't think I explained myself well lol)
Hope it helps!
Tried this, but now it says "unknown label" (when referring to myScore_0000).
 
Screenshot 2024-03-12 175351.png
Code:
    LDA myScore_0000
            CMP #2
            BEQ +levelup
            JMP +nextlevel
            +levelup
            INC myLevel
            
            +nextlevel
            CMP #5
            BEQ +levelup1
            JMP +nextlevel1
            +levelup1
            INC myLevel
            
            +nextlevel1
            CMP #7
            BEQ +levelup2
            JMP +endlevel
            +levelup2
            INC myLevel
            
            +endlevel
 

smilehero65

Active member
View attachment 8016
Code:
    LDA myScore_0000
            CMP #2
            BEQ +levelup
            JMP +nextlevel
            +levelup
            INC myLevel
           
            +nextlevel
            CMP #5
            BEQ +levelup1
            JMP +nextlevel1
            +levelup1
            INC myLevel
           
            +nextlevel1
            CMP #7
            BEQ +levelup2
            JMP +endlevel
            +levelup2
            INC myLevel
           
            +endlevel
Oh...well... of course...
Because myScore_0000 didn't exist.
This was basically the structure I was referring to:

1710291200394.png
(This is from the Maze Module...you should check the tutorials)


Seems like you will need to update the method of managing your score.
 
Oh...well... of course...
Because myScore_0000 didn't exist.
This was basically the structure I was referring to:

View attachment 8017
(This is from the Maze Module...you should check the tutorials)


Seems like you will need to update the method of managing your score.
Oh, that makes sense. I'll try it this way then. But that also means I'd need to increase the score differently, wouldn't it?
 
Yes, I changed them all to fit the new variables. That’s when the error occurred (before I did that it just said “myScore” didn’t exist)
 

kevin81

Well-known member
I think you'll need to use the base myScore variable instead of myScore_000.
Also, by default, the tens digits, hundreds digits, etc. are named myScore_10, myScore_100, and so on. There is no such thing as myScore_000 by default.

So you could try:
Code:
    AddValue #$03, myScore, #$05, #$02
    UpdateHudElement #$04
...and see if that works better.

For reference, this is how the AddValue macro works:
AddValue.png
 
I think you'll need to use the base myScore variable instead of myScore_000.
Also, by default, the tens digits, hundreds digits, etc. are named myScore_10, myScore_100, and so on. There is no such thing as myScore_000 by default.

So you could try:
Code:
    AddValue #$03, myScore, #$05, #$02
    UpdateHudElement #$04
...and see if that works better.

For reference, this is how the AddValue macro works:
AddValue.png
I misread Smile Hero’s example. I thought I would have to get rid of myScore and replace it with myScore_0, etc. I switched it to myScore_000 (which I guess has to be 100) because I thought it would be simpler. I assumed since they were all separate variables that they would each be incremented individually, and since my points go up by 500 whenever an enemy is destroyed it would be easiest to increase that one specifically. Guess not.
 
Top Bottom