How do I make Time score and throw object ?

Get help using Construct 2

Post » Mon Oct 20, 2014 4:23 am

Hi

I know there is a tutorial for high score but what i want to do is to make a Time Score. counting the seconds and then show it as a high score (( who beat the enemy faster become in the top )) also he can write his name near it.

and about the second problem. I want to make object throw things random for a small destiny (( see the pic that i upload it ))
You do not have the required permissions to view the files attached to this post.
B
4
S
1
Posts: 18
Reputation: 395

Post » Mon Oct 20, 2014 4:36 am

On start of layout- Every x seconds (1) - Add 1 to variable (time). Then simply text box "Total Time: "&time.

Although there is probably an internal way to grab time since start of layout... anyone?

I am assuming on the second part you mean throw objects a random distance from a center point?
You could spawn as many objects (even random amounts) at the center object that you want with bullet behaviors in them... set their bullet speed to 100, bullet angle to random(360), wait random(0.25,3), bullet stop.
You could either set them visible when they spawn or after they stop... whatever effect your after.

If you want it less random, more like the picture you could use choose instead, ie. random(choose 45,90,110,234,350) to have better control of what angles it can send objects in...
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

Post » Mon Oct 20, 2014 5:35 am

On start of layout- Every x seconds (1) - Add 1 to variable (time). Then simply text box "Total Time: "&time.

i didn't understand the last part ? when i add the text box to the score layer near the time can the payer write his name and save it and every one on the world can see it ? this game is not multilayer.

I am assuming on the second part you mean throw objects a random distance from a center point?
You could spawn as many objects (even random amounts) at the center object that you want with bullet behaviors in them... set their bullet speed to 100, bullet angle to random(360), wait random(0.25,3), bullet stop.
You could either set them visible when they spawn or after they stop... whatever effect your after.

If you want it less random, more like the picture you could use choose instead, ie. random(choose 45,90,110,234,350) to have better control of what angles it can send objects in...

I do it. now it's throw in random angle and then stop but it get back to move :x

here is what happening
Evey 10 second this object appear and throw things. this things move in different angle and stop. now the problem is when the next 10 second come the object appear and throw new things but also the old things moving again ? so how to stop it for ever
B
4
S
1
Posts: 18
Reputation: 395

Post » Mon Oct 20, 2014 6:37 am

didn't understand the last part ? when i add the text box to the score layer near the time can the payer write his name and save it and every one on the world can see it ? this game is not multilayer.


Not multilayer! Even free version gives you 3 layers.. that is like making apple pie without a crust... :)

OK, what I meant by "Then simply text box "Total Time: "&time" was anywhere you needed to display the "time" variable you were filling with the time-since-start number... In order to do what you are wanting you would need to put a text box like I show ("Total Time: "&time) [The "Total Time" can be changed to anything you want between the ""] You would then need a blank type box object beside your text object if you want them to write their name. HOWEVER, unless you are storing both the name and time value in webstorage or some other method the data will be gone as soon as they close the game.
I have done a tutorial on webstorage if it helps (https://www.scirra.com/tutorials/1152/introduction-to-webstorage-simplified).

A better way would be to have to player input their name somewhere before the game starts and save it to a name variable, then at finish display both variables like so: "Awsome, "&name "you lasted "&time "seconds!" and then store these to a persistent website location (several tutorials out there for this type thing).

here is what happening
Evey 10 second this object appear and throw things. this things move in different angle and stop. now the problem is when the next 10 second come the object appear and throw new things but also the old things moving again ? so how to stop it for ever


This is happening because Construct2 doesn't know which instance of the object you are wanting to perform actions on. You will need to "pick" the newly spawned objects and not the old ones. In order to "pick" an instance it must be referenced in the Conditions portion of the event.
An easy way off the top of my head is to put an Instance variable inside the spawned object and say call it "finished = 0", now right after your stop action after they have spawned and run their course you would add a set Instance variable action to finished=1. Now in your initial spawning Conditions you would add a (object type)-instance variable finished (doesnot) = 1 (or either = 0 your preference).
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

Post » Wed Oct 22, 2014 6:51 am

Message: AeleaS is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
Not multilayer! Even free version gives you 3 layers.. that is like making apple pie without a crust... :)

OK, what I meant by "Then simply text box "Total Time: "&time" was anywhere you needed to display the "time" variable you were filling with the time-since-start number... In order to do what you are wanting you would need to put a text box like I show ("Total Time: "&time) [The "Total Time" can be changed to anything you want between the ""] You would then need a blank type box object beside your text object if you want them to write their name. HOWEVER, unless you are storing both the name and time value in webstorage or some other method the data will be gone as soon as they close the game.
I have done a tutorial on webstorage if it helps ().

A better way would be to have to player input their name somewhere before the game starts and save it to a name variable, then at finish display both variables like so: "Awsome, "&name "you lasted "&time "seconds!" and then store these to a persistent website location (several tutorials out there for this type thing).

This is what i exactly thinking for now. I will do my best to make it in my game :mrgreen:
This is happening because Construct2 doesn't know which instance of the object you are wanting to perform actions on. You will need to "pick" the newly spawned objects and not the old ones. In order to "pick" an instance it must be referenced in the Conditions portion of the event.
An easy way off the top of my head is to put an Instance variable inside the spawned object and say call it "finished = 0", now right after your stop action after they have spawned and run their course you would add a set Instance variable action to finished=1. Now in your initial spawning Conditions you would add a (object type)-instance variable finished (doesnot) = 1 (or either = 0 your preference).

Now i solve the time problem but still i have problem with throwing object. now i change my mind :) i want to throw different kind of objects with that same before conditions. I think Array will solve my issue but i don't know how to use it. do you know how ?

Thank you for the information and all details that you wrote it for me. it's really helped me and i am sure that many other will see it helpful :)
B
4
S
1
Posts: 18
Reputation: 395


Return to How do I....?

Who is online

Users browsing this forum: Lancifer and 20 guests