How do I create an object everytime game add 1 to a variable

Just started using Construct 2? Post your questions here

Post » Wed Oct 11, 2017 5:39 am

Hi everyone.

I'm working in an infinite runner and I would like to create an object everytime the game add 1 to the variable "level". The truth is I can't figure out how to do it, i was looking for a tutorial but can't find one, maybe i'm not using the right words for this search.

Thanks
Siva2D
B
18
S
5
Posts: 13
Reputation: 1,468

Post » Wed Oct 11, 2017 6:54 am

I guess you have an event that adds 1 to the variable "level" so the easiest way would be to create the object you want in the same event that you already have adding to the variable.

But you can do a variable check and spawn based on that but the first option seems like the easiest one.

Or have a misunderstood the problem?
B
61
S
26
G
16
Posts: 802
Reputation: 14,495

Post » Wed Oct 11, 2017 3:51 pm

Hi Anonnymitet.

For the 5 first levels i make 5 event that add 1 to variable level, and spawn the object when the player reach certain points in the game, for this i'm using another variable that check the distance traveled. When I reach level 5 I make another event that add 1 to level every 60 seconds. But I had to repeat in every event the same spawn object action.

I would like to create a new event that spawn the same object everytime the variable Level add1.
Siva2D
B
18
S
5
Posts: 13
Reputation: 1,468

Post » Thu Oct 12, 2017 10:36 am

You can add another variable OldLevel and do this:

Code: Select all
System->Compare variable-> Level not equal OldLevel
   System-> Create object .....   
   OldLevel=Level
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
17
S
9
G
125
Posts: 1,735
Reputation: 66,791

Post » Thu Oct 12, 2017 4:07 pm

dop2000 wrote:You can add another variable OldLevel and do this:

Code: Select all
System->Compare variable-> Level not equal OldLevel
   System-> Create object .....   
   OldLevel=Level


Thank you, it's working
Siva2D
B
18
S
5
Posts: 13
Reputation: 1,468


Post » Sun Oct 15, 2017 4:22 am

Lordshiva1948 wrote:Siva2D try this tutorial

https://www.scirra.com/tutorials/4791/level-selector


Thank you Lordshiva
Siva2D
B
18
S
5
Posts: 13
Reputation: 1,468



Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests