How do you make power-ups have a time limit?

Description: Internal scripting system of SMBX-38A Engine based on the simple VB-like language
Moderators: Yoshi021, Lx Xzit, 5438A38A, Semi-moderatos, Moderators

OfficialJC02 M
Topic author, Nice citizen
Nice citizen
Avatar
OfficialJC02 M
Topic author, Nice citizen
Nice citizen
Age: 18
Reputation: 4
Posts: 18
Joined: 30 May 2020
Youtube channel URL

Post #1by OfficialJC02 » 9 Oct 2020, 20:09

For example, if Mario gets the Fire Flower, he would only have it for a certain amount of time before losing it.

Victor ManuelMR M
Marquis
Marquis
Avatar
Victor ManuelMR M
Marquis
Marquis
Age: 19
Reputation: 59
Posts: 171
Joined: 7 Feb 2018

Post #2by Victor ManuelMR » 9 Oct 2020, 21:03

OfficialJC02 wrote:For example, if Mario gets the Fire Flower, he would only have it for a certain amount of time before losing it.

Code: Select all

dim timer as double

do
if char(1).status = 3 then timer += 1

if timer > 400
   char(1).status = 2
   timer = 0
end

call sleep(1)
loop
Image
[1.4.5] - Dream Team at The Challenging Portals:
Image

OfficialJC02 M
Topic author, Nice citizen
Nice citizen
Avatar
OfficialJC02 M
Topic author, Nice citizen
Nice citizen
Age: 18
Reputation: 4
Posts: 18
Joined: 30 May 2020
Youtube channel URL

Post #3by OfficialJC02 » 9 Oct 2020, 22:35

I have 2 questions:

1. How do I add music while Mario is Fire Mario? (The music from Super Mario Galaxy)
2. How do I keep Mario from losing the power-up when he gets hit but still takes damage?

I know it’s a lot to ask, but this will help me a lot with other scripts as well.

FyreNova
Nice citizen
Nice citizen
Avatar
FyreNova
Nice citizen
Nice citizen
Reputation: 2
Posts: 12
Joined: 27 Oct 2019

Post #4by FyreNova » 23 Nov 2020, 2:04

OfficialJC02 wrote:I have 2 questions:

1. How do I add music while Mario is Fire Mario? (The music from Super Mario Galaxy)
2. How do I keep Mario from losing the power-up when he gets hit but still takes damage?

I know it’s a lot to ask, but this will help me a lot with other scripts as well.
  • use events; you can find the needed function here.
  • Code: Select all

    dim timer as double

    do
    if char(1).status = 3 then timer += 1

    if timer > 400
       char(1).status = 2
       timer = 0
       if char(1).status <> 3
       char(1).status = 3
       char(1).hitpoint -= 1
       end if
    end if

    call sleep(1)
    loop


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: Victor ManuelMR And 3 guests