Add star pickups

Get help using Construct 2

Post » Sun Feb 03, 2013 12:28 pm

I am making a platformer wich will have randomly genereted world. I have one platform sprite that will change width. I tryed dividing the width by 100 and ading a star every fot every 100pixel. It didnt work. Can someone tell me a simple way too add a sprite every 100 pixels on top of enother sprite?


And sorry for my english i know it sucks but i am not american nor from england
B
11
Posts: 11
Reputation: 580

Post » Sun Feb 03, 2013 2:53 pm

Something like;

[Event] System.Repeat Platform.Width / 100

[Action] System.Create Star at (Platform.X - Platform.Width / 2 + loopindex * 100)
B
12
S
4
G
2
Posts: 59
Reputation: 3,739

Post » Sun Feb 03, 2013 5:43 pm

THAT WORKES
LOVE YOU
B
11
Posts: 11
Reputation: 580

Post » Sun Feb 03, 2013 5:56 pm

There is still a problem of destroying them
as they respawn instantly
B
11
Posts: 11
Reputation: 580

Post » Sun Feb 03, 2013 7:44 pm

Try to add blank 'Else' event after 'Repeat' event
B
13
S
6
G
3
Posts: 20
Reputation: 4,091

Post » Sun Feb 03, 2013 8:20 pm

does not work
la sigh
i have destroy on collision but it doesnt even glich when i stand there
B
11
Posts: 11
Reputation: 580

Post » Sun Feb 03, 2013 8:47 pm

You need to do the above as a sub-event in "On Start of Layout" so it only happens once when the layout begins.

[Event] On Start of Layout
   [Subevent] System.Repeat Platform.Width / 100
   [Action] System.Create Star at (Platform.X - Platform.Width / 2 + loopindex * 100)
B
12
S
4
G
2
Posts: 59
Reputation: 3,739

Post » Sun Feb 03, 2013 8:51 pm

I know that woud work but the problem is that
it is generating new platforms as you walk
B
11
Posts: 11
Reputation: 580

Post » Sun Feb 03, 2013 9:19 pm

Try putting that code into a function.

Then, when ever you create a platform, you can call the function to generate stars.
B
12
S
4
G
2
Posts: 59
Reputation: 3,739

Post » Mon Feb 04, 2013 5:47 am

I am sorry too truble you soo but how do i make functions?
i tryed using groups.Didnt work. Is there no easyer way?
I am allmost using 20 lines of code too do this?
B
11
Posts: 11
Reputation: 580

Next

Return to How do I....?

Who is online

Users browsing this forum: BipolarMike, Televangelist, totoe and 23 guests