Smooth Scrolling Demonstration

Need help with using DizzyAGE then look here
User avatar
Noggin the Nog
Hard Boiled Egg
Posts: 412
Joined: Sun Jul 01, 2012 12:04 am

Post by Noggin the Nog » Fri Jun 10, 2016 3:43 pm

Hi Steve. Sorry, I just want to make sure it's nothing obvious before I dive into the code - are roomx, roomy and roomw defined in the function?

I'm thinking something might have gone missing if you copy/pasted the code. Also, could you tell us what sort of error you're getting?

Grandad
Hard Boiled Egg
Posts: 1382
Joined: Sat Aug 08, 2009 10:47 am
Location: Balham - gateway to the south

Post by Grandad » Sat Jun 11, 2016 9:06 am

I don't think it's a big coding issue Simon as the demo works fine (even when I've added status checks to turn off and on the vertical scrolling and change the background tile) - always think it best to play around with something to get to grips with it! So made sure I knew what needed to be added or altered to the handler, movement and game files when setting up a new 'test game' to explore further.

It's a -1 issue in the HandlerGameAfterUpdate function that appears before the game starts as the engine can't find the R_LEFT define. Roomx, roomy, roomw & roomh are defined prior to the

left = RoomGet(roomx,roomy,R_LEFT) + roomw/2;

command line. But ...the R_LEFT = 0, etc defines are included in the def.gs file so the engine should not be having a -1 issue especially as the def.gs file is a straight copy from the demo.

My brain hurts!

User avatar
Noggin the Nog
Hard Boiled Egg
Posts: 412
Joined: Sun Jul 01, 2012 12:04 am

Post by Noggin the Nog » Sat Jun 11, 2016 1:18 pm

Do you mean a BADTYPE error that comes up right after the game has loaded?

All I can think of in that case is that there's a duplicate #def somewhere in one of the script files or maybe some rogue ///s cancelling out the line.

Also - a random thing I found out recently - in the dizzy.gs file, the def and gamedef files have to be at the top of the list for the defines to work in the other scripts.

That's everything I can think of for now.

Grandad
Hard Boiled Egg
Posts: 1382
Joined: Sat Aug 08, 2009 10:47 am
Location: Balham - gateway to the south

Post by Grandad » Sun Jun 12, 2016 12:52 pm

"Thunk, thunk, thunk" - that's me banging my head! Decided to scrap the test game, so took one of my 'standard' game templates and deleted all the extra stuff involving movement. Then copied the def, gamedef, movement files, the scrolling and backdrop coding from both the game and handler files of the demo. Altered the frame rate to 48 and delay rate to 4, added a tile for the background and thought let's go.

The game opened, but the backdrop wouldn't load (it is dynamic 240 x136 and the ID is the same as the bgd define in the update backdrop) Then noticed that Dizzy was a tad jittery and over the course of two and a half screens walks out of sight as he is moving faster than the game is scrolling.

Now comes the interesting part, tried to restart and got the loading screen, pressed enter and got "EXCEPTION_INT_DIVIDE_BY_ZERO at address 0x4294c8" Aaaaaaghhhh!!!!

OK, I'll do one more test, I'll replace all the coding in my template with everything in the demo - and alter the door functions and the scroll reading functions. If that works then it must be a conflict with some of my extra coding that I always include.

User avatar
Noggin the Nog
Hard Boiled Egg
Posts: 412
Joined: Sun Jul 01, 2012 12:04 am

Post by Noggin the Nog » Sun Jun 12, 2016 5:26 pm

I had a look through the scripts for my demo today and discovered there's a function necessary for the scrolling hiding in the util.gs file.

I don't think it's got anything to do with the problems you're having - it only affects the y-scrolling, but you'll need to include the function (called PlayerFallCheck()) in your game.

Grandad
Hard Boiled Egg
Posts: 1382
Joined: Sat Aug 08, 2009 10:47 am
Location: Balham - gateway to the south

Post by Grandad » Mon Jun 13, 2016 8:15 am

Thanks Simon, handy to know. As it was I switched all the coding in my 'template' test game with your demo and of course it works fine. Now to slowly add the extra stuff I put into a game to see what happens - I might have to come back to you for advice at some point as the climbing code and the run fast code reset the custom movement of the character. Thanks for your help.

User avatar
Noggin the Nog
Hard Boiled Egg
Posts: 412
Joined: Sun Jul 01, 2012 12:04 am

Post by Noggin the Nog » Wed Aug 03, 2016 9:35 pm

I revisited this and made a few updates, ironed out some kinks.

In particular, I discovered that my smooth movement code didn't work with moving platforms, so I've corrected that.

Also, I've added a feature where Dizzy shares the motion of horizontally moving platforms, so you don't have to walk along as the platform moves. :cool:

Check it out: https://www.dropbox.com/s/mojafni7bdwi7 ... o.zip?dl=0

Grandad
Hard Boiled Egg
Posts: 1382
Joined: Sat Aug 08, 2009 10:47 am
Location: Balham - gateway to the south

Post by Grandad » Thu Aug 04, 2016 9:12 am

Thanks Simon, downloaded and ready to 'blow my mind' (damn, I must still be in the 1980s) :laugh:

nb - it'll be interesting to see how you've done Dizzy moving on platforms - I never used AI, but created a move function (x or y plus a few pixels and reset) and added a collider on the platform that did the same to Dizzy, so that he could still leap off when necessary.

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Tue Oct 11, 2016 5:55 pm

I've only just seen this, but I did something with moving platforms in Pirate Ship Dizzy.
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

Grandad
Hard Boiled Egg
Posts: 1382
Joined: Sat Aug 08, 2009 10:47 am
Location: Balham - gateway to the south

Re: Smooth Scrolling Demonstration

Post by Grandad » Sat Aug 05, 2017 9:49 am

Hi Simon, been having another go at this recently, but still not having much success. However, it made me wonder why Alex included the basic viewport coding in DizzyAge if you needed to add so much extra coding to make it work properly ...so as I have a (slightly) better understanding of what's going on in the coding (although not much success in implementing it :dizzy_frown: ) I set the viewport function to 1 in the startup of one of my earlier games to see what happened and discovered that the movement works fine but the view is cockeyed as you also view the adjacent screens as the map centers around Dizzy. So, took out the Y scrolling line and it is almost perfect for horizontal scrolling - just needed to have a block halfway across the rooms at the extreme ends of the map to stop it scrolling past the border (Did try setting the room properties but the engine just laughed at me!).

However, you can amend the coding in the 'HandlerGameAfterUpdate' function to check the status of a dynamic object outside the game area, ie if status is 1 add the room = and X coding, if status is 2 add the room = and Y coding and if status is 3 add both. Therefore if status = 0 the scrolling isn't turned on. Then just added suitable Open/Close room commands or suitably placed colliders to change the status and did a test by having the top of a hill halfway up the screen before turning on the vertical scrolling to go down the hill and turn if off halfway down the bottom of the hill screen which worked fine.

As this may be a 'reasonable but long winded' solution for me to deal with scrolling for future games I'm now going to try and add your 'background' movement and see what happens (already did a test when using your template to switch backdrop from night to day and back again and it worked).

Plus, I might be 'ready' to crack open Colin's 'A Pirates' Life game and see how he did the scrolling ...but it will probably just make my brain hurt again. :hitwall:

Post Reply