How do I reduce the canvas size for every tick?

Get help using Construct 2

Post » Sat Nov 07, 2015 9:36 am

This is my homework: On every 5 seconds of the game time, the size of the enemies is increased 2 times of the current size and the game area size is decreased by 2%.
I figured out how to increase the size of enemies, but how should i reduce the canvas size(game area)?
I tried that by using set layout scale which equal to LayoutScale-0.02, when i do that each and every thing in the layout is reduced.
I would appreciate if any one can help me out here.
Last edited by prabjotsingh50 on Sat Nov 07, 2015 8:20 pm, edited 1 time in total.
B
3
Posts: 6
Reputation: 187

Post » Sat Nov 07, 2015 11:00 am

There is an action in System 'Set Canvas Size'. You could do something like.
Code: Select all
Global number x=0
Global number y=0
Global number shrink=3       

System| On start layout ->  System| Set x to WindowHeight
                        ->  System| Set y to WindowWidth

System| Every tick  -> System | Set canvas size to x y
                    -> System | Subtract shrink from x
                    -> System | Subtract shrink from y


You have to set x and y in 'On start layout' to WindowHeight and Width and you have to set 'fullscreen in browser' in the project properties to off.
B
24
S
3
G
1
Posts: 454
Reputation: 2,171

Post » Sat Nov 07, 2015 12:29 pm

Thank You @Asmodean for your efforts, but that didn't work. I have found a solution for it. I reduced the Background layer using set layer scale added few invisible rectangles out side it and voila everything is like the png, the game gets over when i hit those rectangles and the sizes of the enemies and the player is also not reduced.
B
3
Posts: 6
Reputation: 187

Post » Sat Nov 07, 2015 2:17 pm

Pfftttt..This is also not working...its reducing the size from bottom not from the center the change of origin also is not making it reduce from all sides. Also the enemies wont bounce of the rectangles.
Guys this thing is getting tricky.. Please help me out.
B
3
Posts: 6
Reputation: 187

Post » Sat Nov 07, 2015 2:27 pm

Asking other people to do your homework?

How is the game area set up?
You are talking about rectangles and bouncing?
It's easier getting the right answer if you give all the information needed and ask the right question.

If you want to reduce canvas size @asmodean gave the answer, bu tyou seem to want something else..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Nov 07, 2015 3:09 pm

LOL..Its an assignment with 3 goals actually... I have completed everything except the game area thing or to say the canvas.

The enemies (shapes) bounce of the edges and the player also is not allowed to leave the layout. For that i have created few rectangles around the layout given them the solid behavior and set those enemies to bounce of the solids and also to stop player from leaving. Now if i use the technique given by @Asmodean something weird his happening (I have my project set into 1280x720) , so I tried to scale the layer which is the base layer (Background) with all those rectangles.

The things which are happening ( I don't want them to happen):
1. The layer is re-sizing from the bottom right corner (I want it to re-size from all the sides)
2. The rectangles now are not colliding with the player (Form other posts I have seen that objects should not be set on solids to collide with objects on another layer)
Last edited by prabjotsingh50 on Sat Nov 07, 2015 8:21 pm, edited 1 time in total.
B
3
Posts: 6
Reputation: 187

Post » Sat Nov 07, 2015 3:37 pm

Seems like making the game area smaller would consist of moving those rectangles towards the center..
That way the available area would become smaller, right?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Nov 07, 2015 5:29 pm

Yeah exactly and the background layer or a sprite should also become smaller to look like the png. Since those rectangles are invisible.
B
3
Posts: 6
Reputation: 187

Post » Sat Nov 07, 2015 6:15 pm

well than you could just set the rectangles compared to the boundingbox of the background sprite every tick and change the size of the backgroundsprite and you're done..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sat Nov 07, 2015 8:19 pm

Senpai.... Thank you that worked !!
B
3
Posts: 6
Reputation: 187


Return to How do I....?

Who is online

Users browsing this forum: dop2000, Google [Bot], matriax and 8 guests