[Request] Change player speed

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

PaperMarioYT
Topic author, Citizen
Citizen
PaperMarioYT
Topic author, Citizen
Citizen
Reputation: 1
Posts: 9
Joined: 4 Jul 2019

Post #1by PaperMarioYT » 31 Jul 2019, 23:46

Good, I need a script that changes the player's speed, I need to make the character slower.

Dry Bones M
Good citizen
Good citizen
Avatar
Dry Bones M
Good citizen
Good citizen
Age: 18
Reputation: 18
Posts: 25
Joined: 1 Jul 2017
Location: Germany

Post #2by Dry Bones » 1 Aug 2019, 22:47

You can change the speed of Players by using the char(j).xsp and char(j).ysp commands:
for x-Speed(Right):
Spoiler

Code: Select all

do
If char(j).xsp > 0 then
char(j).xsp = char(1).xsp * q
end if
call sleep(1)
loop
for x-Speed(Left)
Spoiler

Code: Select all

do
If char(j).xsp < 0 then
char(j).xsp = char(1).xsp * q
end if
call sleep(1)
loop
for y-Speed(Jumping)
Spoiler

Code: Select all

do
If char(j).xsp < 0 then
char(j).ysp = char(1).ysp * q
end if
call sleep(1)
loop
for y-Speed(Falling)
Spoiler

Code: Select all

do
If char(j).xsp > 0 then
char(j).ysp = char(1).ysp * q
end if
call sleep(1)
loop
j must be replaced by 1 or 2 (Represents Player 1 or 2)
q must be replaced by the number of times, the player is faster compared to the normal speed
(Because you want your character to be slower, you should replace q with a factor smaller than 1 (e.g. 0.5))
(and you must add at least two Auto-Start-Events that activate the scripts (one for each x-Direction), optionally for the other two scripts. Oh, and the .ysp command for Jumping is a bit buggy when using a factor less than 1, had to learn that the hard way... )
Hope this helps you.
"Reality is merely an illusion, albeit a very persistent one." - Albert Einstein


My largest Project (to get a better view of the image, click on it (it's too large to be inserted here)):
Spoiler
Image


#RemasterThousandYearDoor


Return to “TeaScript”

Who is online (over the past 5 minutes)

Users browsing this forum: 4 guests