Random generation issue

Just started using Construct 2? Post your questions here

Post » Mon Apr 17, 2017 10:26 am

Hi
I am generating some objects randomly and its working good but if its getting delayed in starting the layout means from start screen if you delay in pressing "start" button all the object are getting loaded and all the objects coming at a time as a group.
I have tried fixing this by grouping the events and deactivating this group on start of layout and activating on space bar is pressed but this didnt worked.How to fix this.Please help me.
Thanks in advance
B
23
S
8
G
1
Posts: 35
Reputation: 2,095

Post » Mon Apr 17, 2017 2:56 pm

ramyaswetha wrote:Hi
I am generating some objects randomly and its working good but if its getting delayed in starting the layout means from start screen if you delay in pressing "start" button all the object are getting loaded and all the objects coming at a time as a group.
I have tried fixing this by grouping the events and deactivating this group on start of layout and activating on space bar is pressed but this didnt worked.How to fix this.Please help me.
Thanks in advance


I've a few questions for you that will help us get to the solution:

1) Are you generating the same object type or different object types?
2) How many objects are you trying to create?
3) Do you want the objects to spawn at the same time or one at a time with a delay in between?
4) Do you want to wait to spawn the objects until after the start button has been pressed?
B
21
S
9
G
4
Posts: 473
Reputation: 4,285

Post » Mon Apr 17, 2017 9:41 pm

I believe what you are saying is.. If the player delays at the start screen all the elements are already running once the game starts visually.

This is a common issue and one I had to solve myself in my space shooter. It is not an easy thing to fix ironically. Common sense would say "start of level" means when the player can see it.. this is not true however with C2. You will have to take all of your elements that need to wait until the player is actually "in" the game and tell them when to start separately of on start event. The easiest way to do this is with a trigger. I put a start button on my intro/instruction screen. The start button being pressed changes a "Started" variable from 0 to 1 and my on start of layout conditions out Started=1. This way the layout junk won't load till the player actually starts the game. I then moved the order of the on start actions or put some after a wait=1 action to make sure the player had time to get in visually and not notice any behind the curtain shenanigans.

In clicker wizard I simply put a "click or touch to start game" flashing text on splash screen. This text event carries the same trigger type var and will let level load only after player clicks/touches screen.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
70
S
19
G
8
Posts: 639
Reputation: 9,674


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 3 guests