ScratchData LogoScratchData
Back to Locomule's profile

simple solution for a scrolling world with off screen object interactions

LOLocomule•Created March 6, 2023
simple solution for a scrolling world with off screen object interactions
9
7
80 views
View on Scratch

Instructions

WASD/arrows to walk around There are 10 red admirers who blink if you get close enough Any time you have a game with a big, scrolling world persistence beyond the edge of the stage becomes an issue. How do walking enemies continue interacting with the world and moving within it while colliding with walls? Can you shoot an enemy that runs off screen? How do we make the game world mechanics continue to function for objects that are currently off screen? How about enemies that fight each other whether the player is there or not, like a battle royale? This solution makes all that and more pretty easy. The entire game is being played out with tiny sprites and screen size map sprite with everything ghosted. The map is zoomed, scrolled and stamped, then everything within range of the player is pen stamped creating a zoomed in, scrolling view of the ghosted game world. The enemies and player constantly write their costume#, X and Y positions to lists, always sorting where they insert their data based on their Y position. The stamping sprite reads the Y list, looking for the first entry close enough to be on the stamped/zoomed screen. Or is it? The stamping sprite continues through the Y list, checking every successive entry's X value to see if they are still close enough to be on screen. If both Y and X conditions are met the stamper switches to the costume saved in the costume list, moves to the saved X and Y list values (adjusted for 400% zoom) and stamps that object. We are using Y sorting so that our top to bottom pen stamping style creates a natural 3D layering effect. Set the "mini game world transparency" slider to 100 and run back and forth through an enemy to see it in action. Right now there isn't much going on. Enemies wander around, bounce off walls, and blink when they get close enough to the player. I'll add shooting next and see about making the stamped view zoomable.

Description

I was playing Florr which involves lots of time running across big maps when the idea occurred to me. So I credit Florr :DD

Project Details

Project ID814506888
CreatedMarch 6, 2023
Last ModifiedApril 4, 2023
SharedMarch 6, 2023
Visibilityvisible
CommentsAllowed