Smooth Scrolling & Parallax Module Issues (Partially Self-Solved)

Started by Vault15, Tue 16/10/2012 17:12:28

Previous topic - Next topic

Vault15

Room 301 is the title screen and Room 1 is my first town. All of the buttons work fine. My base code is from the demo for Smooth Scrolling & Parallax (if that helps any).

Some of my GlobalScript code is derived from the demo included with this:
The Parallax Module

Main Issues
1. Music will not play in the title screen.
2. When I click "start game" everything works perfectly EXCEPT that the Smooth Scrolling module seems to be disabled. I can move the character around, but I'm stuck in the boxed area instead of being able to walk around the town with the scrolling screen. When I set the main character as "cEgo" vs the default "TitleChar" then he auto starts in town and everything works as I want with the scrolling. I obviously want a title screen so I have the character set back as TitleChar. I notice that it seems to turn on and the character is centered for a split second, then it pans to the left some and is stuck.
3. Not a must, but if anyone would like to share their Options Gui (title screen Settings menu) or just the code for it I'd love to see :).

Thanks in advance for any help!

I noticed that people seem to not know what to say to this issue  :(; that's not a good sign...


Here's part of my GlobalScript:


Code: AGS

function repeatedly_execute() 
{
 
  if(gIconbar.GetAtScreenXY(mouse.x, mouse.y) == gIconbar && Mouse.Mode != eModeUsermode3) 
  { 
    Mouse.Mode = eModeUsermode3;
  }
  else if(gIconbar.GetAtScreenXY(mouse.x, mouse.y) != gIconbar && Mouse.Mode == eModeUsermode3 && TitleChar.Room != 301)
  {
    Mouse.Mode = eModeWalkto;
  }
  else if(TitleChar.Room == 301)
  {
    Mouse.Mode = eModeUsermode3;
  }
 
 
}



The Title Screen script is as follows:
Code: AGS

function room_AfterFadeIn()
{
  


  aTest1Title.Play();
  mouse.UseModeGraphic(eModeUsermode3);
  gIconbar.Visible = false;
  gStatusline.Visible = false;
  gTitleScreen.Visible = true;
  
  Mouse.Visible = true;
  Mouse.Mode = eModePointer;
  

}



and the Code for the button when I click "Begin" in the Title Screen:
Code: AGS

function TitleBegin_OnClick(GUIControl *control, MouseButton button)
{
    gTitleScreen.Visible = false;
    cEgo.SetAsPlayer();
    SmoothScroll_PxOn();

}


Edit: I think I found the culprit  :).
While browsing through the code over and over, I noticed this function:

function game_start(){
 
  targetCharacter = player;
 
  system.vsync=true;
}

So naturally I added "targetCharacter = cEgo;" to my Begin button on the title screen and now it centers on the character. My controls are wonky now with right clicking, but I feel like I can probably do the rest on my own. I hope this helps some poor soul in the future when they have the same problem  :tongue:



Update #2: Fixed the Smooth Scrolling Module entirely.

I ended up adding a global variable to trigger in the begin button so that the global script knew when to stop forcing the title screen mouse state (I need it to change when right-clicking to walk, use, look at, talk).

My "repeatedly_execute()" script was slightly modified to:
"else if(TitleChar.Room == 301 && clickbegin == 0)" to take the global variable into account.

function TitleBegin_OnClick(GUIControl *control, MouseButton button)
{
    clickbegin = 1;
    gTitleScreen.Visible = false;
    cEgo.SetAsPlayer();
    targetCharacter = cEgo;
   
}

SMF spam blocked by CleanTalk