How do I transfer a screenshot between levels?

  • Hello everyone,

    I have been following the Breakout tutorial series. However I have decided to add a few extra features to continue learning about C2.

    One of the features I want to add is when the player wins or loses the game takes a screenshot right at that moment and transfer it to another layout (as background) where the win/lose message would display.

    I was able to display the screenshot in the same layout fine, however it seems when I use an event to switch to the next layout the screenshot is gone. So I am wondering how can I go about doing that?

    Thank you very much in advance.

  • Give this a try. Click on the blue box to take a screen capture. (For some reason it happens on the second time you click the box.) I load the screen capture into a rotating sprite, so you will see it when the capture happens. Click on the red bar to move to another layout. (You can click on the red bar in the second layout to return to the first.)

    FYI: if you really want to mess with your head click on the blue box 3 or more times...

  • Thank you very much.

    I have checked the file you have and that is weird... I have something similar setup on my own game and it doesn't work.

    I'll try copy and pasting your events and see what happens.

    Again, thank you very much!

  • OK, I have tried to do the same as what is inside you project.

    The only difference is that I don't do the check every tick, the check is when every enemy is dead on the layout that the snapshot is taken then I save it to an empty sprite after which I load the next level with that sprite but it won't load anything.

    Here is a screenshot of my own setup.

  • I don't see anything from what I can see of your code. I might be tempted to a sub-event on your System > BricksNumber = 0 of System > Trigger once while true, and place the System > Take snapshot of canvas... as an action under that sub-event. But I think that is kind of grasping at straws...

    It's not one of those Doh! type things like the Snapshot sprite has it's Initial Visibility set to Invisible... or the Snapshot sprite is under a Layer that is set to Transparent No...

  • Sorry that I dont know but how do you make a level page with the levels locked until you beat the one before

  • JRoberts

    I believe you can achieve the concept by creating a layout with a list of icons on which the icons each is correspond ed with a level. When the player clicks on one you load that level.

    You can add an array of variablez to check with it.if the player has playes the level or not. Just a guess though since I am not quite that advanced in C2.

    @Shirokuma

    I'll give it a try with the system run once.

    I am also prett certain all layers are visible and transparent but I'll double check.

  • Vallar im not good with C2 yet so do you know the variables i would use. The player is a ball and to unlock you have to collide with the finish box

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • First, sorry about the weird spelling in my previous post; I have been using my phone to post recently.

    As for your question JRoberts:

    Well I am still starting out with C2, too. However, I believe you would create an instance variable for each icon (icon represents a level in the level selection screen) and when the player finishes the level (when the ball touches the goal), you change that variable (for example from 1 to 2 or from 0 to 1).

    I believe it would be something like this:

    Create an instance variable for each icon called "finished" and with default value 0 (this is the LOCKED version for the icon and therefore the level).

    Use condition Player On Collision With Another Object Goal > Icon Add to "finished" 1

    In the layout where all the levels are created you would have the following:

    System On Start of Layout + Icon Compare Value "finished" = 1 > Icon Set Animation to "UNLOCKED"

    Mouse On Object Clicked "Icon" + Icon Animation Running "UNLOCKED" >System Go To "Icon's Level"

    Hope that helps.

    @Shirokuma

    I have tried exactly what you mentioned and it again didn't work. I checked whether I had anything set to invisible or if a layer is set to non-transparent... all of them were set correctly. Not sure if this is a C2 bug or is it something with my own game; any ideas what I can do from here?

  • Vallar I understand what your talking about but i dont know how to use instance variables. I set the instant variable for 0 on level but when i do

    Player + On Collision With Another Object Gaol > Icon Add to "Finished" 1

    it says i dont have a instant variable

  • Valler Also my animation isnt working could you make a spread sheet

  • Hmm...

    I see, alright. I'll try to create a .capx file for you. Just I am at work now so might take me sometime.

  • Hello,

    Here is a .capx of how to test of an instance variable. It isn't the best example but what I could get out as fast as I can.

    Hope it helps.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)