How do I transfer a screenshot between levels?

Just started using Construct 2? Post your questions here

Post » Mon Mar 24, 2014 6:04 pm

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.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Tue Mar 25, 2014 11:50 pm

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... ;)
You do not have the required permissions to view the files attached to this post.
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Wed Mar 26, 2014 7:11 am

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! :D
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Thu Mar 27, 2014 8:53 am

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.

Image
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Fri Mar 28, 2014 2:10 am

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...
B
17
S
4
G
3
Posts: 172
Reputation: 1,933

Post » Fri Mar 28, 2014 2:47 am

Sorry that I dont know but how do you make a level page with the levels locked until you beat the one before
B
4
Posts: 19
Reputation: 240

Post » Fri Mar 28, 2014 3:03 am

@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.
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Fri Mar 28, 2014 3:18 am

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
B
4
Posts: 19
Reputation: 240

Post » Fri Mar 28, 2014 11:50 pm

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?
B
19
S
7
Posts: 161
Reputation: 1,751

Post » Sat Mar 29, 2014 6:29 pm

@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
B
4
Posts: 19
Reputation: 240

Next

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests