How do I zoom or scale a sprite constantly when pressing key

0 favourites
  • 12 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hi their just bought construct 2 and find it too be a more then relatively decent tool

    for non-programming game development somewhat however I have a problem that's really irritating me....

    Let me explain my situation I'm trying to create a pre-rendered 3d graphics pesudo-3d game

    similar to the sims bustin out on game boy advance anyways the problem is

    I have a player and I want the character too shrink if closer to a door exit

    or grow if not closer to the door exit .

    I've tried using set scale when a key is pressed but it only scales once

    their doesn't seem to be a way to consistently grow or shrink an object

    when a key or anything is pressed and or if closer to an object or not???.

    Please if someone knows how this can be achieved in the most over simplified way possible

    let me know I'm not very good with maths I've tried programming game engines for like 3-4 years

    and was only able to get a 3d model up with some ambient lighting , animated backgrounds and after reading a tutorial

    a relatively okay 3d camera after the most annoying and frustrating experience ever which I never wanna do again!.

    I hope to hear from someone...

  • anyone I've tried that lerp function but it only does it once -_-.

  • On Start of layout > Sprite - set size to (set the original size of sprite width/height)

    Keyboard - key is down

    System - every tick > Sprite - set size to (self.width + 'enter a number' * dt, self.height + 'enter a number' * dt)

  • I was able to create what I think you are wanting using Action: Size Set to(Sprite2.Width-5, Sprite2.Height-5) repeated 10 times on a 100 sized sprite to make it 50% smaller and then using Action: Size Set to (Sprite2.Width+5, Sprite2.Height-5) 10 times to grow it back to 100%. I put a wait 0.5 after the action and copied it 10 times. I tried using the repeat condition but it didn't allow the wait 0.5 to trigger and made the sprite shrink and grow instantly which is not what you want.

  • jeffige

    Where can I find every tick ,

    I've looked through the system events and I can't see anything resembling a tick ;/, can you tell me

    where to find it um but thank you for the dt part will try that?.

    yes set size seems to do it kind of but if it gets too small it flips on it self which is really annoying

    so if their's some way to stop it from shrinking below a certain size guess that would be ideal for me.

  • My example works as you wanted - tested.

    System - On Start of layout > Sprite - set size to (set the original size of sprite width/height)

    Keyboard - key is down

    (right click on the far left side of Keyboard line so the whole line is highlighted ) > ADD -> sub event

    • System - every tick (it's under the General heading)

    > Sprite - set size to (self.width + 'enter a number' * dt, self.height + 'enter a number' * dt)

  • jeffige

    Fantastic it does work and really well what is this whole tick thing anyways

    is that the main javascript loop ticker?

    The house is a placeholder ;P

    I totally didn't see that every tick why they put it under general is beyond me their are a few little ui oddities

    that don't make a lot of sense in construct 2 but otherwise it's a really kind and relatively considerate development interface for games

  • Every tick is a system expression. It means everytime the events are checked. Which is about 60 times a second or something like that.

  • You can just use the LiteTween Behaviour by Rex.

    You can find it in the Completed Addons section.

    You can easily make that effect using it and it has a whole bunch of other features as well.

    Try it out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Husui I shall

  • use everytick as sub event...

  • use every tick as a sub event

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