Image API Scene Transition

JeffreyDriver

  • Posts: 1482
I'm trying to figure out how to create the following effect as a scene transition:
1. Take a screenshot of the current screen
2. Switch to the next scene
3. Load the  screenshot as an image which covers the entire screen
4. Split the image into squares (Say 8 x 8px or 4 x 4px)
5. Randomly cycle through each square and clear that part of the image until the entire image has been cleared to reveal the new scene below.

Parts 1 to 3 aren't the issue,but I'm stumped on parts 4 and 5. Any help gratefully appreciated. Thanks.
Current Projects:
Retro Redux Compilation (NEW).
Retro Redux (untitled) (NEW).
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

SadiQ

  • Posts: 1766
If you can code it's simple. Just modify the Cool Transition extension .
If you can't code,maybe someone can help? (I'm running really low on free time if you're in a hurry).
Proud member of the League of Idiotic Stencylers! Doing things in Stencyl that probably shouldn't be done.

CmdrWhitey13

  • Posts: 467
4. Split the image into squares (Say 8 x 8px or 4 x 4px)
5. Randomly cycle through each square and clear that part of the image until the entire image has been cleared to reveal the new scene below.

Parts 1 to 3 aren't the issue,but I'm stumped on parts 4 and 5.

Your system for swapping scene while having the screenshot is interesting where there is no global image or image instance. I would say a global list pehaps?

4. Clear block with width and height may work.
5. Maybe with a list of coords and random block.

I could perhaps draft something up.
 

JeffreyDriver

  • Posts: 1482
Thanks SadiQ. I don't code unfortunately. I looked into the extension and one of the blocks seems to be close to what I want.

CmdrWhitey13, thanks, yeah I was going to use the clear block.

I finally have a prototype working, though I'm not sure how reliable it is. At the moment it only clears 4 blocks.

The coords of the areas that are to be cleared are stored in the 'Screenshots locations' list.  At the moment, these coords have been added manually, but I'm trying to figure out a way of calculating and adding all the available coords to the list automatically, based upon the the size of the areas I want to clear (e.g. 8x8px)

The coords are stored in the list in the format of 'X Y'. (e.g. 0 0, 0 240, 160 0, 160 240)

Code explanation if it will help:

TRANSITION
  • This is run when the player navigates away from the current scene
  • A screenshot of the current scene is taken and saved to a map

WHEN CREATED
  • When the next scene is loaded, it checks if an image has previously been stored
  • If so, assign to an attribute
  • Attach it to the screen
  • (It is at this point I need to calculate all potential coords and add them to the 'Screenshot Locations' list)
  • Trigger 'Reveal'

REVEAL
  • Checks if there are any locations in the 'Screenshot Locations' list
  • If so, set 'Selector' number attribute to a random number based upon number of available coords in the list
  • Get the correct random coord from the list and split the value into separate values (The X and the Y), adding them to a new list (Current Location)
  • Remove the used coord from the list
  • Clear the portion of the image
  • Reset the 'Current Location' list
  • Repeat

« Last Edit: February 13, 2018, 04:40:35 am by JeffreyDriver »
Current Projects:
Retro Redux Compilation (NEW).
Retro Redux (untitled) (NEW).
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

JeffreyDriver

  • Posts: 1482
I managed to get this working!

The method of adding all the potential area locations to the list is a little clunky, and is more effort to make changes to than I would like, but it works.

At the moment, the size of the areas are 32x32px, as it actually takes a while to clear 16px areas when removing 1 every 0.02 seconds (for some reason 0.01 seconds causes it to freeze) and the current code won't allow clearing of more than 1 at a time.

I'd like to clear 8x8px areas but I'd probably need to clear at least 10 at a time.
Current Projects:
Retro Redux Compilation (NEW).
Retro Redux (untitled) (NEW).
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk