Spreading bullets around - possible in Construct 2 now?

For questions about using Classic.

Post » Thu Apr 07, 2011 10:06 am

Hi, I have tried playing around with Construct 2 a bit. I have never touched Construct 1 though, and I am aware that Construct 2 is still under beta development.

So the thing is this, right now, I want this simple thing written in the pseudo code below but I am not sure whether it is possible yet:

[code:22a3zi2c]

//a bomb explodes and spreads bullets in all directions.
for (int i = 0; i < 360; i += 10){
GameObject *createdObject_ID = createObject(bullet, thisObject->getX(), thisObject->getY());
createdObject_ID->setDirection( i );
createdObject_ID->setSpeed( 3 );
}

[/code:22a3zi2c]

So is it possible in Construct 2 now or not? Am I missing something? What should I look for in the event sheet?
B
2
G
1
Posts: 38
Reputation: 526

Post » Thu Apr 07, 2011 10:26 am

Yes it is possible, and then events will look practically the same as your pseudo code. How far were you able to get?
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Thu Apr 07, 2011 2:40 pm

Well, I was looking around for a drag and drop object for "loop" or the like, but I'm a complete newbie in here, and I am not sure which goes where yet. In other words, I don't know how do you do this? I got all the source code in my head, but not sure how to pull it off exactly in Construct 2. :(
B
2
G
1
Posts: 38
Reputation: 526

Post » Thu Apr 07, 2011 7:02 pm

When adding events the "for" loop is under System.

Here is a capx:
[url:hj2qc2p4]http://dl.dropbox.com/u/5426011/c2/360shoot.capx[/url:hj2qc2p4]
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Fri Apr 08, 2011 3:28 am

Thanks for the code, R0J0hound. That clears up lots of things. At first, I thought there can only be one condition. :)
B
2
G
1
Posts: 38
Reputation: 526


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 8 guests