--[[

ColoredSouls API V0.8 by vlams1

CREDITS:

----------------

ORIGINAL GRAVITY FOR BLUE SOUL(changed to be more precise): TurretBot https://www.reddit.com/user/TurretBot

ORIGINAL PURPLE SOUL: Joms http://www.reddit.com/user/Jomy582

ANIMATION FOR YELLOW BULLETS: bluemagic123 https://www.reddit.com/user/bluemagic123

----------------

HOW TO INSTALL:

add this line outside any functions in a wave script:

require "Libraries/coloredsouls"

and add this folder to your sprites:

https://www.dropbox.com/s/sgemid0f50smfax/ColoredSouls.rar?dl=1

------------------------------------------DOCUMENTATION----------------------------------------

STATES:

ORIGINAL:

Red - Standard

Blue - left-right movement only, gravity and jump mechanic.

-Green DOES NOTHING YET - like rythem games: left, right, up and down.

-Yellow(upside down sprite) BROKEN(crashes) - Standard movement, use Z to shoot lasers.(max two on screen)

Purple - left-right movement only, up-down movement between three lanes.

CUSTOM:

Cyan - Nine locations to move to, using up-down-left-right.

Orange - Time moves only when you move.

FUNCTIONS(run everything with a star in front every tick):

SoulRedSetup() - Resets soul to original state

SoulBlueSetup() - Changes soul color and blocks standard movement

* SoulBlue() - left right movement, jumping and gravity

SoulPurpleSetup() - Changes soul color and blocks standard movement

* SoulPurple() - Custom movement

SoulPurpleArena() - Sets arena size and creates webs(add a variable to the bullets and make a custom hit, or the webs will hurt the player!)

SoulPurpleArenaRemove() - Removes webs

SoulCyanSetup() - changes soul color and blocks standard movement

* SoulCyan() - Custom movement

SoulCyanArena() - Sets arena size and creates grid(add a variable to the bullets and make a custom hit, or the grid will hurt the player!)

SoulOrangeSetup() - Changes soul color and blocks standard movement

* SoulOrange() - Custom movement

VARIABLES:

OrangeSpeed - player speed (1 to 4)

OrangeTimer - goes up when player moves, resets when player stands still

OrangeWorldSpeed - Opposite of OrangeSpeed (4 to 1)

OrangeRealTime - goes up per tick

OrangeWorldTime - goes up [1 / OrangeWorldSpeed] per tick, goes up normally when player constantly moves

-]] --

--RED SOUL

function SoulRedSetup ( )

Player . SetControlOverride ( false )

Player . sprite . color = { 255 / 255 , 0 / 255 , 0 / 255 }

Player . sprite . rotation = 0

end

--BLUE SOUL

function SoulBlueSetup ( )

Player . sprite . color = { 0 / 255 , 60 / 255 , 225 / 255 }

Player . SetControlOverride ( true )

Player . sprite . rotation = 0

BlueFall = 0.05

BlueMotion = - 0.1

BlueGravity = 0.025

BlueJump = 3.3

BlueJumpInput = 0

end

function SoulBlue ( )

if Input . Left > 0 and Player . x > - 100 then

Player . MoveTo ( Player . x - 2 , Player . y , false )

end

if Input . Right > 0 and Player . x < 100 then

Player . MoveTo ( Player . x + 2 , Player . y , false )

end

if Input . Up > 0 then

BlueJumpInput = BlueJumpInput + 1

else

BlueJumpInput = 0

end

if BlueJumpInput > 0 and BlueJumpInput < 5 and Player . y == - Arena . height / 2 + 8 then

BlueMotion = BlueJump

end

if Player . y > - Arena . height / 2 + 8 then

BlueMotion = BlueMotion - BlueFall

end

if Player . y < - Arena . height / 2 + 9 then

Player . MoveTo ( Player . x , Player . y + 0.1 , false )

end

if BlueMotion > 0 then

BlueMotion = BlueMotion - BlueGravity

end

Player . MoveTo ( Player . x , Player . y + BlueMotion , false )

if Input . Up == 0 and Player . y > - Arena . height / 2 + 8 and BlueMotion > 0 then

BlueMotion = BlueMotion / 15

end

end

--GREEN SOUL

function SoulGreenSetup ( )

Player . sprite . color = { 0 / 255 , 192 / 255 , 0 / 255 }

Player . SetControlOverride ( true )

Player . sprite . rotation = 0

end

function SoulGreen ( )

--nothing D:

--i will add stuff here.. later..

end

function SoulGreenArena ( )

end

--YELLOW SOUL

function SoulYellowSetup ( )

Player . sprite . color = { 255 / 255 , 255 / 255 , 0 / 255 }

Player . SetControlOverride ( false )

Player . sprite . rotation = 180

YellowBullets = { }

end

function SoulYellowSetupNoFlip ( )

Player . sprite . color = { 255 / 255 , 255 / 255 , 0 / 255 }

Player . SetControlOverride ( false )

Player . sprite . rotation = 0

YellowBullets = { }

end

function SoulYellow ( )

if # YellowBullets == 2 then

YellowBullets [ 2 ] . MoveTo ( YellowBullets [ 2 ] . x , YellowBullets [ 2 ] . y + 10 )

if YellowBullets [ 2 ] . absy > 600 then

YellowBullets [ 2 ] . Remove ( )

table.remove ( YellowBullets , 2 )

end

local frame = YellowBullets [ 2 ] . GetVar ( "frame" )

if frame < 10 then

frame = frame + 1

YellowBullets [ 2 ] . SetVar ( "frame" , frame )

YellowBullets [ 2 ] . sprite . Set ( "ColoredSouls/YellowBullet/frame" .. frame )

end

if frame < 10 then

frame = frame + 1

YellowBullets [ 2 ] . SetVar ( "frame" , frame )

YellowBullets [ 2 ] . sprite . Set ( "ColoredSouls/YellowBullet/frame" .. frame )

end

end

if # YellowBullets > 0 then

YellowBullets [ 1 ] . MoveTo ( YellowBullets [ 1 ] . x , YellowBullets [ 1 ] . y + 10 )

if YellowBullets [ 1 ] . absy > 600 then

YellowBullets [ 1 ] . Remove ( )

table.remove ( YellowBullets , 1 )

end

local frame = YellowBullets [ 1 ] . GetVar ( "frame" )

if frame < 10 then

frame = frame + 1

YellowBullets [ 1 ] . SetVar ( "frame" , frame )

YellowBullets [ 1 ] . sprite . Set ( "ColoredSouls/YellowBullet/frame" .. frame )

end

if frame < 10 then

frame = frame + 1

YellowBullets [ 1 ] . SetVar ( "frame" , frame )

YellowBullets [ 1 ] . sprite . Set ( "ColoredSouls/YellowBullet/frame" .. frame )

end

end

if Input . Confirm == 1 and # YellowBullets < 2 then

--Audio.PlaySound('yellowshoot')

local YellowBullet = CreateProjectile ( "ColoredSouls/YellowBullet/frame1" , Player . x , Player . y )

YellowBullet . SetVar ( "frame" , 1 )

table.insert ( YellowBullets , YellowBullet )

end

--[[

if Input.Confirm and #YellowBullets < 2 then

local YellowBullet = CreateProjectile("ColoredSouls/YellowBullet/frame1", Player.x, Player.y)

YellowBullet.SetVar("frame", 1)

YellowBullet.sprite.rotation = 0

YellowBullet.SetVar("Alive", 1)

table.insert(YellowBullets, YellowBullet)

end

for i=1,#YellowBullets do

if YellowBullets[i].IsActive then

local Bullet = YellowBullets[i]

Bullet.MoveTo(Bullet.x, Bullet.y + 5)

local frame = Bullet.GetVar("frame")

if frame < 10 then

frame = frame + 1

Bullet.SetVar("frame", frame)

Bullet.sprite.Set("ColoredSouls/YellowBullet/frame" .. frame)

end

if Bullet.absy > 800 then

Bullet.SetVar("Alive", 0)

table.remove(YellowBullets)

Bullet.Remove()

end

end

end

]] --

end

--PURPLE SOUL

function SoulPurpleSetup ( )

moveUp = false

moveDown = false

moveTimerV = 0

moveCount = 0

playery = 0

Player . sprite . color = { 206 / 255 , 0 / 255 , 212 / 255 }

Player . SetControlOverride ( true )

Player . sprite . rotation = 0

end

function SoulPurple ( )

if Input . Up == 1 and Player . y < tWeb . y and moveDown == false then

moveUp = true

playery = Player . y

end

if Input . Down == 1 and Player . y > bWeb . y and moveUp == false then

moveDown = true

playery = Player . y

end

UpDownController ( )

if Input . Left > 0 and Player . x > - 100 then

Player . MoveTo ( Player . x - 2 , Player . y , false )

end

if Input . Right > 0 and Player . x < 100 then

Player . MoveTo ( Player . x + 2 , Player . y , false )

end

end

function UpDownController ( )

if moveUp == true then

moveTimerV = moveTimerV + Time . dt

if moveTimerV > 0.000001 and moveCount < 4 then

moveTimerV = moveTimerV - 0.000001

Player . MoveTo ( Player . x , Player . y + 10 , false )

moveCount = moveCount + 1

elseif moveCount > 3 then

moveTimerV = 0

moveCount = 0

moveUp = false

Player . MoveTo ( Player . x , playery + 40 , false )

end

end

if moveDown == true then

moveTimerV = moveTimerV + Time . dt

if moveTimerV > 0.000001 and moveCount < 4 then

moveTimerV = moveTimerV - 0.000001

Player . MoveTo ( Player . x , Player . y - 10 , false )

moveCount = moveCount + 1

elseif moveCount > 3 then

moveTimerV = 0

moveCount = 0

moveDown = false

Player . MoveTo ( Player . x , playery - 40 , false )

end

end

end

function SoulPurpleArena ( )

Arena . Resize ( 240 , Arena . height )

tWeb = CreateProjectile ( "ColoredSouls/purpleweb" , 0 , 40 )

mWeb = CreateProjectile ( "ColoredSouls/purpleweb" , 0 , 0 )

bWeb = CreateProjectile ( "ColoredSouls/purpleweb" , 0 , - 40 )

end

function SoulPurpleArenaRemove ( )

tWeb . Remove ( )

mWeb . Remove ( )

bWeb . Remove ( )

end

--CYAN SOUL

function SoulCyanSetup ( )

Player . SetControlOverride ( true )

Player . sprite . color = { 66 / 255 , 252 / 255 , 255 / 255 }

CyanX = 0

CyanY = 0

Player . sprite . rotation = 0

end

function SoulCyan ( )

CyanX = 0

CyanY = 0

if Input . Right > 0 then

CyanX = CyanX + 20

end

if Input . Left > 0 then

CyanX = CyanX - 20

end

if Input . Up > 0 then

CyanY = CyanY + 20

end

if Input . Down > 0 then

CyanY = CyanY - 20

end

Player . MoveTo ( CyanX , CyanY , false )

end

function SoulCyanArena ( )

Grid = CreateProjectile ( "ColoredSouls/Grid" , 0 , - 33 )

Arena . Resize ( 64 , 64 )

end

--ORANGE SOUL

function SoulOrangeSetup ( )

Player . SetControlOverride ( true )

Player . sprite . color = { 252 / 255 , 166 / 255 , 0 / 255 }

OrangeTimer = 0

OrangeSpeed = 1

OrangeWorldSpeed = 5

OrangeWorldTime = 0

OrangeRealTime = 0

Player . sprite . rotation = 0

end

function SoulOrange ( )

if Input . Up > 0 or Input . Down > 0 or Input . Left > 0 or Input . Right > 0 then

OrangeTimer = OrangeTimer + 1

elseif OrangeTimer > 3 then

OrangeTimer = OrangeTimer - 4

else

OrangeTimer = 0

end

if OrangeTimer < 61 then

OrangeSpeed = OrangeTimer / 15

end

OrangeWorldSpeed = 5 - OrangeSpeed

OrangeRealTime = OrangeRealTime + 1

OrangeWorldTime = OrangeWorldTime + 1 / OrangeWorldSpeed

if Input . Up > 0 then

Player . MoveTo ( Player . x , Player . y + OrangeSpeed , false )

end

if Input . Down > 0 then

Player . MoveTo ( Player . x , Player . y - OrangeSpeed , false )

end

if Input . Left > 0 then

Player . MoveTo ( Player . x - OrangeSpeed , Player . y , false )

end

if Input . Right > 0 then

Player . MoveTo ( Player . x + OrangeSpeed , Player . y , false )

end