speed and random item

Get help using Construct 2

Post » Fri Jan 03, 2014 7:00 pm

so, im making an "arkanoid" game, and i wanted the ball to gain more speed each time it colides with the player, also each time it colides with an object it may or may not drop an item, how can i do this?


1st objective: each time the ball colides with player increase ball speed
2nd objective: each time the ball colides with another object it may drop or not a item.


*sorry for my bad english
B
5
S
1
Posts: 77
Reputation: 754

Post » Fri Jan 03, 2014 7:06 pm

what behaviour are you using for the ball ?

If you are using bullet, you can increase max speed on every desired collision.

event: ball on collision with player
action: set ball bullet speed to bullet speed + 0.01 (or whatever)


you can manipulate the behaviours speed and acceleration this way easily.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri Jan 03, 2014 7:15 pm

ball on collision with player: set bullet speed - bullet.speed+10

Give the blocks a ChooseSpawn variable
ball on collission with block - block set variable ChooseSpawn - choose(0,0,0,1)
- block compare variable Choosspawn = 1 - block spawn
- - block destroy

this way there is a 25% chance the block will spawn. To spawn different items you could use more numbers than 0 and 1 and spawn accordingly
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jan 03, 2014 7:49 pm

wouldn't

on collision with block
and
random(100)<25

be better ?
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
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Jan 03, 2014 7:56 pm

[QUOTE=RamPackWobble] wouldn't

on collision with block
and
random(100)<25

be better ? [/QUOTE]

performance wise the choose is a lot lighter.
Random also does decimals >_>
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Fri Jan 03, 2014 8:03 pm

I was already planning one question ahead. Changing this event to one that spawns different objects with different probabilities is pretty easy.

There's often no such thing as better, just preferences and I like the choose option for it's adaptibility..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jan 03, 2014 8:27 pm

Thanks or that - I use random() quite a bit, time for a change.

*assimilates*

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
33
G
47
Posts: 1,194
Reputation: 30,812

Post » Fri Jan 03, 2014 9:04 pm

[[email protected]] Thanks or that - I use random() quite a bit, time for a change.

*assimilates*

[/QUOTE]




I use the choose a lot ... if I have some event, which can give a text something, I always add something like   set text choose('hello','hi','welcome','go away')    :)

Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,562

Post » Sat Jan 04, 2014 8:39 pm

im still learning construct, so, i have the bullet effect, but i cant use the "+0.01" speed thing you said, how do i write it so it can work?
i am only putting the +"0.01" there and its not accepting the +
B
5
S
1
Posts: 77
Reputation: 754

Post » Sat Jan 04, 2014 8:40 pm

hmm, i understand the logic but i dont understand the making of... can you send me prints, or maybe a capx so i can see?
B
5
S
1
Posts: 77
Reputation: 754

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 12 guests