How do I create object every 50 score point?

Get help using Construct 2

Post » Wed Jun 24, 2015 3:56 pm

Now im using :
system---> score >50 --->create object
system---> score >100 ---> create object
system---> score >150 ---> create object

but i need one unique solution... thanks!
B
10
S
1
Posts: 49
Reputation: 600

Post » Wed Jun 24, 2015 4:19 pm

look at modulo (see https://www.scirra.com/manual/78/expressions)

with this you could do something like

add to score
..if score % 50 = 0 then create new object
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Wed Jun 24, 2015 8:48 pm

@RamPackWobble:
If the score skips from 49 to 51, this will not work.

Instead I'd go for something like:

function "addscore":
- add to score: f.param(0)
- add to scorespawner: f.param(0)
- call function "scorespawn"

function "scorespawn":
while scorespawner >= 50:
- create object
- substract from scorespawner: 50

All actions that add score would then use the addscore function instead of simply adding x to score.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Wed Jun 24, 2015 10:22 pm

Good point @mindfaQ, a much better / flexible approach.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,892

Post » Thu Jun 25, 2015 8:12 am

Im not sure... is it correct?

Image
B
10
S
1
Posts: 49
Reputation: 600

Post » Thu Jun 25, 2015 8:52 am

I think solved with an easy way:
new variable: "enemycount"

every add score also add 1 to enemycount
if enemycount >= 50 create enemy and set variable "enemycount" to 0

Right?
B
10
S
1
Posts: 49
Reputation: 600

Post » Thu Jun 25, 2015 9:04 am

markuzz78 wrote:I think solved with an easy way:
new variable: "enemycount"

every add score also add 1 to enemycount
if enemycount >= 50 create enemy and set variable "enemycount" to 0

Right?


Exactly the solution I came here to suggest :)
B
58
S
25
G
14
Posts: 789
Reputation: 13,294

Post » Thu Jun 25, 2015 1:59 pm

this is effectivelyy the simpliest way to get this working...
B
16
S
3
Posts: 106
Reputation: 1,408

Post » Thu Jun 25, 2015 5:58 pm

That's pretty much what the functions do. But don't set it to 0, instead substract 50, again for accuracy.
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 7 guests