Author Topic: MODULE: Smooth Scrolling & Parallax v1.7.1  (Read 57612 times)

is it possible to use this along with the 9-verb MI style template
if so how
sorry for the n00b question
currently on an indefinite hold.

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
I'm not able to test it right now, but I see no reason why it shouldn't be. It's not 100% compatible with the verb coin template (because the screen scrolls slightly between the time when you click and the time when you choose an action), but there is a workaround for that.

Please try it and let me know if you run into problems!

i will and i will let you know
currently on an indefinite hold.

Hi,

I'm having trouble figuring this out.
I have a very long background and I am using keyboard controls for movement.
Everytime my character gets towards the edge of the screen the screen will scroll but not fast enough.
Eventually the character outruns the screen.

How do I increase the scroll speed of the screen if there are no objects in the room?

Thanks in advance for any help

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
Try increasing the variable called targetScrollSpeedX and targetScrollSpeedY. You may also need to increase other variables (like slowDownRange) to get it to move smoothly.

Thanks Ali,

That seems to have worked.

I'm having a few troubles now with the character moving a bit choppily.
Is there any way to avoid this?
Also what variable is used to detect how close to the edge the character is?
I would like the edge to be further from the screen so the character doe not have to be close to the edge.

Thanks for the help I really like the look of this module

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
Hi,

This module doesn't affect character movement. The choppy movement is probably to do with anti-glide mode which is less effective for larger character sprites / walkcycles with more frames.

To change the thresholds look for the comments reading "// Scroll towards the player when they are at the edge of the screen":

For the X Position:

Code: Adventure Game Studio
  1.         else if (ScrollingAllowedX && PlayerScreenX < (FloatToInt(0.30 * IntToFloat(ScreenWidth))) && PlayerVelocityX <= 0) TargetPointX = player.x; // Scroll towards the player when they are at the edge of the screen
  2.         else if (ScrollingAllowedX && PlayerScreenX > (FloatToInt(0.70 * IntToFloat(ScreenWidth))) && PlayerVelocityX >= 0) TargetPointX = player.x;
  3.         else if (ScrollingAllowedX && PlayerScreenX < (FloatToInt(0.30 * IntToFloat(ScreenWidth))) && PlayerVelocityX > 0) TargetPointX = GetViewportX() + HalfScreenWidth - 6;  //Except if they change direction
  4.         else if (ScrollingAllowedX && PlayerScreenX > (FloatToInt(0.70 * IntToFloat(ScreenWidth))) && PlayerVelocityX < 0) TargetPointX = GetViewportX() + HalfScreenWidth + 6;

And for Y:

Code: Adventure Game Studio
  1.         else if (ScrollingAllowedY && PlayerScreenY < (FloatToInt(0.30 * IntToFloat(ScreenHeight))) && PlayerVelocityY <= 0) TargetPointY = player.y; // Scroll towards the player when they are at the edge of the screen
  2.         else if (ScrollingAllowedY && PlayerScreenY > (FloatToInt(0.70 * IntToFloat(ScreenHeight))) && PlayerVelocityY >= 0) TargetPointY = player.y;
  3.         else if (ScrollingAllowedY && PlayerScreenY < (FloatToInt(0.30 * IntToFloat(ScreenHeight))) && PlayerVelocityY > 0) TargetPointY = GetViewportY() + HalfScreenHeight - 6;  //Except if they change direction
  4.         else if (ScrollingAllowedY && PlayerScreenY > (FloatToInt(0.70 * IntToFloat(ScreenHeight))) && PlayerVelocityY < 0) TargetPointY = GetViewportY() + HalfScreenHeight + 6;

The '30' and '70' mean that 30% of the screen on the left and right are the scrolling areas. To make the scrolling areas bigger try '40' and '60', to make them smaller try '20' and '80'.

In future releases I will try to make it this simpler to achieve, but I don't have time to work on the module now.

Grim

  • *Dreamer Of The Day*
    • Grim worked on one or more games that was nominated for an AGS Award!
I've just started using it and I really like it!

I encountered a problem though... If the value of PxPos is below 3 an error comes up and game crashes. It seems that 3 and above displays fine, but it's really moving quite fast... I tweaked targetScrollSpeed because it was too slow and it's now 40... but I don't think that would affect anything, would it?

Also, the game is keyboard controlled in res 800:600.

EDIT: Same for - values.-1, -2 crash the game and -3 makes object practically follow character on the screen like a dog on the leash....
« Last Edit: 20 Jun 2010, 23:06 by Grim »

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
I've never had a crash like that at 800x600, perhaps it could be caused by keyboard control. Could you post the content of the error message to help me work out what the issue is?

0 is supposed to create static objects for objects a long way off, like the sun in the demo game. The negative numbers are possibly useful for a lens flare effect or similar, but most of the time only 0 and above would be useful. At this time in the morning, I can't think why the crash would happen for values under 3!
« Last Edit: 21 Jun 2010, 08:20 by Ali »

Grim

  • *Dreamer Of The Day*
    • Grim worked on one or more games that was nominated for an AGS Award!



This came up for an object with PxPos set for 1....

Kweepa

  • Mutated Guano Deviser
    • Best Innovation Award Winner 2009, for his modules and plugins
    • Kweepa worked on one or more games that won an AGS Award!
    •  
    • Kweepa worked on one or more games that was nominated for an AGS Award!
Did you add the PxView property to the schema for objects?
Make sure line 381 still says GetProperty("PxView") - you could have accidentally changed it.
Still waiting for Purity of the Surf II

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
Thanks Steve, as far as I can see that must be the problem.

Let me know if you keep having trouble!

Grim

  • *Dreamer Of The Day*
    • Grim worked on one or more games that was nominated for an AGS Award!
Yeah, line 381 says just that. I haven't altered any of it.

But I think this isn't much of a problem- I'm happy just using setting for 3, 4 and 5. :)

I must also say I really love this module and it really adds a lot to the look of my project already!:) So, thanks!

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
Glad you're finding it useful. Please let me know if you've added the property PxView? If you haven't then there must be something wrong with the script.

Jonathan Wedge

  • It's the time of ICEY!!!
    • Jonathan Wedge worked on one or more games that was nominated for an AGS Award!
hey i cant figure out why it gives me an error at 509 & 769. it comes up before the game even starts.

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
That sounds like you haven't added the required properties. See this section in the module information:

Code: Adventure Game Studio
  1. ////////////////////////
  2. //Required Properties://
  3. ////////////////////////
  4. //
  5. // Before starting, you must create the following properties
  6. // in AGS.
  7. //
  8. // NOTE: You must do this even if you do not plan to use
  9. //  the parallax effect. It doesn't take long, but I'm sorry
  10. //  all the same.
  11. //
  12. // PxPos:
  13. //
  14. //  Name: PxPos
  15. //  Description: Stores an object's parallax position
  16. //  Type: Number
  17. //  Default Value: 0
  18. //
  19. // PxView:
  20. //
  21. //  Name: PxView
  22. //  Description: Stores the pixel-adjustment view number
  23. //  Type: Number
  24. //  Default Value: 0
  25. //
  26. // PxLoop:
  27. //
  28. //  Name: PxLoop
  29. //  Description: Stores the pixel-adjustment loop number
  30. //  Type: Number
  31. //  Default Value: 0
  32.  

Jonathan Wedge

  • It's the time of ICEY!!!
    • Jonathan Wedge worked on one or more games that was nominated for an AGS Award!
so how do i add'em

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
Look up the word 'properties' in the AGS manual index. All the information you need is there.

Jonathan Wedge

  • It's the time of ICEY!!!
    • Jonathan Wedge worked on one or more games that was nominated for an AGS Award!
it works! but is there a way to keep the camera following my player until he stops?

Ali

  • What will become of the baron?
    • Ali worked on one or more games that won an AGS Award!
    •  
    • Ali worked on one or more games that was nominated for an AGS Award!
If you mean you want the camera to stop moving the instant the player stops moving, then I'm afraid that's not possible. As it is the player stops, and then the camera takes a short while to come to a stop smoothly.

To make the camera and player stop simultaneously the module would have to anticipate when the player was going to stop and start to slow down. I don't know how I'd script that. Also I think the effect would be unnatural, in film a camera operator rarely stops panning the instant an actor stops moving.
« Last Edit: 07 Sep 2010, 02:08 by Ali »