How do I use timers to scale and create multple objects

Get help using Construct 2

Post » Sat Sep 10, 2016 1:58 pm

Hey all! Thanks for reading my post in advance. Two quick questions.

How do I smoothly scale a sprite larger (or smaller)? Sine isn't what I'm looking for. My code seems to do the opposite. Very very slowly makes things smaller. I want sprites to smoothly grow as they move downwards.

Question two. How do I create multiple objects in an event. Create Wait Create Wait doesn't work. I want to create/spawn 5 sprites in line and have them move down and scale larger, simulating a 3D-ish effect.

Here's a pic of my code. I'm trying to do both scale and create a multiple coin sprites. My code is doing the opposite I think with scaling. It's making it smaller as it travels. My code makes one coin move toward the player (making it smaller) and another with a 0 bullet angle of motion. What can I do to fix this issue also?

Image
Last edited by heyguy on Mon Sep 12, 2016 8:37 am, edited 1 time in total.
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Sat Sep 10, 2016 3:18 pm

There are lots of miss conception about events. I suggest you to read more about how events work in manual.

The first condition is a trigger, which means it doesn't run every thick but everytime something happens. In your sub-events the set scale action needs to run every thick to work properly and I'm assuming that timer isn't triggering so many times. Also, just to let you know, only for each in a condition already runs every thick so there is no need to use every thick condition

Example of what you wanted. https://www.dropbox.com/s/l8dmxyq5n6plt ... .capx?dl=0
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Mon Sep 12, 2016 8:33 am

Thanks for the comment kossglobal. I really do need to go through the manual more thoroughly.

So from what I've read on the forums, people suggest you use timers as opposed to system expressions Every Tick/X seconds. This was my first attempt at seriously using timers. At least I'm partly successful with it because it's spawning and scaling :mrgreen: Is there a way to possibly do this using timers?

I'm trying to some sort of car based Dragons Lair-like animation game. Essentially each movie clip/ screen section of the game would have things spawn and move toward the player. Here's a bit more of my code. Let me know if I'm wrong for using them and should use every x seconds instead. I removed the useless bits you mentioned in your post. Gonna implement the scale changes you made in the capx soon. Just curious how to properly get timers to work now. Thanks!

Image
B
30
S
15
G
22
Posts: 183
Reputation: 14,221

Post » Mon Sep 12, 2016 2:25 pm

You missed @kossglobal 's point. You can't do scaling & dt inside a timer. That part needs to be done every-tick.

http://www.blackhornettechnologies.com/ ... rTime.capx
ImageImageImage
B
71
S
22
G
248
Posts: 3,761
Reputation: 138,073

Post » Mon Sep 12, 2016 7:01 pm

heyguy wrote:Thanks for the comment kossglobal. I really do need to go through the manual more thoroughly.

So from what I've read on the forums, people suggest you use timers as opposed to system expressions Every Tick/X seconds. This was my first attempt at seriously using timers. At least I'm partly successful with it because it's spawning and scaling :mrgreen: Is there a way to possibly do this using timers?

I'm trying to some sort of car based Dragons Lair-like animation game. Essentially each movie clip/ screen section of the game would have things spawn and move toward the player. Here's a bit more of my code. Let me know if I'm wrong for using them and should use every x seconds instead. I removed the useless bits you mentioned in your post. Gonna implement the scale changes you made in the capx soon. Just curious how to properly get timers to work now. Thanks!

Image


You are doing the same mistakes man. Do something like this:
Global Variable (ScaleValue)
---on timer "5seconds" -> create obj enemy, Move to bottom
------ X<=248 -> set angle of motion
------ X>=248 -> set angle of motion

---Every tick -> Add 0.08*dt to ScaleValue, Set Scale to ScaleValue
B
56
S
21
G
3
Posts: 602
Reputation: 6,612


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 15 guests