• Stormys • New • Free • Vertical & Horizontal Parallax Template • for GS users...

StormyStudioStormyStudio United KingdomMember Posts: 3,989
Afternoon world….

I'm pleased to announce another 100% Free template from Stormy Studio.com

image

A couple of days ago a fellow GS user emailed me asking for some help with vertical parallax to go along with the more common horizontal parallax..

So I created this little 'Vertical & Horizontal Parallax Template' .

It's all labelled up, and hopefully gives others something to learn from, adjust and implement into their own games, storybooks, apps or what ever.

As well as the rules for the parallax offsets for foreground and background layers, it also includes rules which stop the constraining behaviours happening when outside a given area around the camera. This should reduce the load on the CPU as well as stop actors from moving so far out of the scene that they are automatically destroyed when they go 500px outside the scene area.

Head here to download the template for free:
http://www.stormystudio.com/game_templates.html

And here's a little video preview to see what I'm talking about:



I hope its of use for some of you.

Cheers

Jon

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited August 2013

    @StormyStudio

    Looking terrific, Jon - there's a few or more solutions to the parallax prob. as you know - I look forward to downloading your file to see your solution. Looking really smooth and responsive on the video, congrats, and generous of you to donate to the GameSalad community. :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited August 2013
    Cheers @gyroscope ...

    As always I'm sure there might be a better more efficient way but this works well for me and only requires a few behaviours.

    I did it from scratch can't be 100% sure if its how I've done parallax in my games before but seems to be as good a way as any.

    It's also pretty simple to understand, separate actors for each of the parallax layers, which could be reduced to using the same actor with the parallax value set as a self attribute... but then it gets all the trickier to explain to those new to the shores of GameSalad.
  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited August 2013
    I had a go at the same thing as I was probably contacted by the same person. Mine worked but didn't look as sweet as yours! Nor did it come with a YouTube video :)

    I was still quite chuffed though as I got mine working with two expressions for x and y. The same expressions were attached to different sized backgrounds.

    One problem with it is that it requires you to specify the level width and height, and I was too lazy/busy to introduce camera movement. These are the two expressions using constrain attribute, and the minimum required to move the backgrounds around.

    self.Position.X = (self.Size.Width / 200) * (100-((game.Player X / game.Level Width) * 100))
    self.Position.Y = (self.Size.Height / 200) * (100-((game.Player Y / game.Level Height) * 100))

    The 200 here (self.Size.Width / 200) stops it from disappearing off of the screen and being destroyed.
  • UtopianGamesUtopianGames Member Posts: 5,692
    Looks great Jon, I'm sure a lot of people will find it useful.

    Darren.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    @KevinCross
    Your way looks interesting... gonna have to put that into GS myself to figure out whats happening there. Which value are you varying for the different levels of parallax?... or is that down to the actor width?

    @DeepBlueApps cheers Darren...
    I'm sure it will make its way over to DeepBlueApps eventually, if you want it :-)

  • KevinCrossKevinCross London, UKMember Posts: 1,894
    edited August 2013
    Here's a link to it. http://www.kevincross.co.uk/?attachment_id=109

    I need to mention that I've not yet had to move the camera around a bigger scene so I didn't look at doing that when I worked on this one. Nor have I ever set up a scene bigger than the camera, but I'm guessing those bigger than the camera still use the full x and y coordinates so it should work on any size level, as long as you update two game attributes with the level size.

    I'm not sure it's correct, as I've never had to do it before but it gave the GS member an idea on how it might be done.

    And the different levels of parallax is automatically calculated based on the background size which is why the two expressions work on any sized background without having to make any adjustments with each:

    self.Size.Width and self.Size.Height.
  • Braydon_SFXBraydon_SFX Member, Sous Chef, Bowlboy Sidekick Posts: 9,273
    Awesome, Jon. Looks good! Thanks for sharing!
  • DeadlySeriousMediaDeadlySeriousMedia ArizonaMember Posts: 838
    Sweet! Very usefull!
  • alimpo83alimpo83 Member Posts: 188
    It's very useful for platform games and runner games, as an example. It's very nice!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @StormyStudio -- I can't seem to download the correct file. Instead, I'm getting the Time Machine project. The video looks great! I am very interested in seeing your solution.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Doh!... yep someone just emailed me to tell me too...

    Try it now...

    :-O
  • mesaticusmesaticus Member Posts: 51
    Works for me. Awesome. Thanks!
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @StormyStudio --
    Yup! Working now.
    Time to dig into this and learn how to do parallax right!
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited August 2013
    @RThurman
    Woh! woh! ... I never said I did it right :-)

    Hope its useful.
  • BoomshackBarryBoomshackBarry Member Posts: 712
    Nice one Jon, it's really generous of you to put this out as a freebie!
  • beefy_clyrobeefy_clyro Member Posts: 5,394
    Well done Jon, good work, will be useful for many
  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880
    @RThurman
    Woh! woh! ... I never said I did it right :-)
    I am sure its as right as rain, besides its good to encourage others to study and learn.
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Cheers guys... seems like everyone likes the look of it..

    Anyone downloaded and tried it yet?

    Just got round to posting about it on

    Our Twitter: https://twitter.com/stormystudio69
    Our Facebook: https://www.facebook.com/StormyStudio
    Our Own Blog: http://stormystudio.com/blog/
  • LeonardDeveloperLeonardDeveloper Member Posts: 4,630
    edited August 2013
    Really nice template, Cant wait to dig this apart and see how you got this working so seamlessly. :-)
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    edited August 2013
    @LeonardDeveloper
    Hope it runs smoothly for you... I'm sure a good few of you lot will play around with the rules, if you find any cool alternatives/tweaks to the current rules please share.
  • robertkdalerobertkdale USAMember Posts: 912

    Thank you!

    Big Smile Games Play Happy!
    Check out our other GameSalad exclusives.

  • sebmat86sebmat86 Member Posts: 339

    This will help me very much! Thanks a mill! :smiley: <3

Sign In or Register to comment.