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

Get help using Construct 2

Post » Mon Jan 23, 2017 1:00 pm

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...
B
14
S
3
G
1
Posts: 31
Reputation: 1,308

Post » Mon Jan 23, 2017 1:28 pm

anyone I've tried that lerp function but it only does it once -_-.
B
14
S
3
G
1
Posts: 31
Reputation: 1,308

Post » Mon Jan 23, 2017 2:11 pm

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)
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Mon Jan 23, 2017 2:30 pm

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.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
66
S
17
G
8
Posts: 637
Reputation: 9,370

Post » Mon Jan 23, 2017 4:04 pm

@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?.

@chrisinfinger 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.
Last edited by xrosax on Mon Jan 23, 2017 4:16 pm, edited 1 time in total.
B
14
S
3
G
1
Posts: 31
Reputation: 1,308

Post » Mon Jan 23, 2017 4:15 pm

@xrosax

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)
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Mon Jan 23, 2017 4:22 pm

@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
Image

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
B
14
S
3
G
1
Posts: 31
Reputation: 1,308

Post » Mon Jan 23, 2017 4:46 pm

@xrosax

Every tick is a system expression. It means everytime the events are checked. Which is about 60 times a second or something like that.
B
38
S
18
G
19
Posts: 664
Reputation: 14,107

Post » Mon Jan 23, 2017 7:35 pm

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.
B
26
S
14
G
8
Posts: 49
Reputation: 6,250

Post » Fri Feb 03, 2017 5:16 pm

Thanks @Husui I shall
B
14
S
3
G
1
Posts: 31
Reputation: 1,308

Next

Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 24 guests