How do I reduce the canvas size for every tick?

0 favourites
  • 10 posts
From the Asset Store
Pixel Destruction like in "Worms" (Drawing Canvas based)
  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is an action in System 'Set Canvas Size'. You could do something like.

    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
    [/code:1rt4w3zj]
    
    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.
  • 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.

  • 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.

  • 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..

  • 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)

  • 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?

  • Yeah exactly and the background layer or a sprite should also become smaller to look like the png. Since those rectangles are invisible.

  • 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..

  • Senpai.... Thank you that worked !!

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