Hi, just wanted to know if it would be possible to modify the forced scrolling section of this script so that it would still scroll right on the map its currently set to (2-4BonusLevel), but scroll up for another map (4-2SpaceFlight). (Also, it would need to start at the bottom of the map [heh, obviously]; so something extra might need to be added in to tell it to start there). Here's the script I have right now, it does the forced scrolling, the horizontal window split (for 2 player), and a jump button:
' ======== INITIAL STARTUP SCRIPT (Number 0) =========
Sub Player_OnPlayInit()
HostObj.StartScript=1
End Sub
HostObj.SinkObjectEvents ProjectObj.GamePlayer, "Player"
HostObj.ConnectEventsNow()
ProjectObj.GamePlayer.Play 16
Option Explicit
Dim XOff, YOff
Dim P2OffsetX, P2OffsetY
Dim P2Actions, intSprTwo
Const nSprWidth = 41
Const nSprHeight = 75
Sub Display_KeyDown(KeyCode, Shift)
' E=69, S=83, D=68, F=70
If KeyCode = 69 Then P2Actions = P2Actions Or ACTION_UP
If KeyCode = 83 Then P2Actions = P2Actions Or ACTION_LEFT
If KeyCode = 68 Then P2Actions = P2Actions Or ACTION_DOWN
If KeyCode = 70 Then P2Actions = P2Actions Or ACTION_RIGHT
End Sub
Sub Display_KeyUp(KeyCode, Shift)
If KeyCode = 69 Then P2Actions = P2Actions And Not ACTION_UP
If KeyCode = 83 Then P2Actions = P2Actions And Not ACTION_LEFT
If KeyCode = 68 Then P2Actions = P2Actions And Not ACTION_DOWN
If KeyCode = 70 Then P2Actions = P2Actions And Not ACTION_RIGHT
End Sub
Sub Player_OnAfterMoveSprites()
Dim oMap, oPlayer, oLayer, nLyrWid, nLyrHgt, i
Set oPlayer = ProjectObj.GamePlayer
Set oMap = oPlayer.rMap
'-----Two-Player-Stuff-----
'If ProjectObj.GamePlayer.rMap.name = "0-4LevelSelect" or ProjectObj.GamePlayer.rMap.name = "map2" or ProjectObj.GamePlayer.rMap.name = "map3" or ProjectObj.GamePlayer.rMap.name = "map4" then
If ProjectObj.GamePlayer.rMap.name <> "0-4LevelSelect" then
intSprTwo = -1
oPlayer.ScrollMarginY = 185
else
Set oLayer = oMap.MapLayer(1)
If intSprTwo < 0 then
For i = 0 to oLayer.SpriteCount - 1
If oLayer.Sprite(i).rDef.Name = "Player2" then intSprTwo = i
next
End If
With oLayer.Sprite(intSprTwo)
oPlayer.ScrollMarginY = 62
If .ProcessAction(P2Actions) Then
.CurState = (.CurState Mod (.rDef.Template.StateCount \ 2)) _
+ .rDef.Template.StateCount \ 2
.CurFrame = .CurFrame Mod .rDef.StateFrameCount(.CurState)
Else
.CurState = (.CurState Mod (.rDef.Template.StateCount \ 2))
End If
oMap.ViewTop = 240
If P2OffsetX + oPlayer.ScrollMarginX > .X Then
P2OffsetX = .X - oPlayer.ScrollMarginX
End If
If P2OffsetX + oMap.ViewWidth - oPlayer.ScrollMarginX < .X + nSprWidth Then
P2OffsetX = .X - oMap.ViewWidth + oPlayer.ScrollMarginX + nSprWidth
End If
If P2OffsetY + oPlayer.ScrollMarginY > .Y Then
P2OffsetY = .Y - oPlayer.ScrollMarginY
End If
If P2OffsetY + oMap.ViewHeight - oPlayer.ScrollMarginY < .Y + nSprHeight Then
P2OffsetY = .Y - oMap.ViewHeight + oPlayer.ScrollMarginY + nSprHeight
End If
If P2OffsetX < 0 Then P2OffsetX = 0
If P2OffsetY < 0 Then P2OffsetY = 0
nLyrWid = oLayer.Columns * 32
nLyrHgt = oLayer.Rows * 32
If P2OffsetX > nLyrWid - oMap.ViewWidth Then P2OffsetX = nLyrWid - oMap.ViewWidth
If P2OffsetY > nLyrHgt - oMap.ViewHeight Then P2OffsetY = nLyrHgt - oMap.ViewHeight
oMap.Draw P2OffsetX, P2OffsetY, False
oMap.ViewTop = 0
End With
End If
'-----Automatic-Scrolling-Stuff-----
If ProjectObj.GamePlayer.rMap.name = "2-4BonusLevel" then
XOff = XOff + 1
With ProjectObj.GamePlayer
if .PlayerSprite.X <= XOff then
if .PlayerSprite.DX < 0 then .PlayerSprite.DX = 1
.PlayerSprite.DX = .PlayerSprite.rDef.Template.MoveSpeed
if .PlayerSprite.X < XOff - .PlayerSprite.Width / 2 then
XOff = 1
End if
end if
.rMap.Draw XOff, YOff
End With
End If
End Sub
Sub Player_OnControllerMove(OldActions, NewActions)
'-----Jumping-Player-----
With ProjectObj.GamePlayer.PlayerSprite
If (Not OldActions) And NewActions And ACTION_BUTTON2 Then
If (.rDef.SolidTest(.X, .Y + .Height) Or .rDef.SolidTest(.X + .Width - 1, .Y + .Height)) Or (Not .pRideOnRef Is Nothing) Then
.DY = - .rDef.Template.JumpHeight
End If
End If
End With
End Sub
intSprTwo = -1
HostObj.SinkObjectEvents ProjectObj.GamePlayer, "Player"
HostObj.SinkObjectEvents CurrentDisplay, "Display"
HostObj.ConnectEventsNow()