Random Item Drops (Ghost Shooter)

For questions about using Classic.

Post » Mon Apr 05, 2010 6:04 pm

Hello all,

Total noob here! :) I've just completed the Ghost Shooter tutorial and decided to make it a bit more interesting - I've added a secondary rocket launcher with limited ammo and higher, splash damage; shootable monster spawn boxes; a frag counter; and rocket ammo + health powerups.

I'm trying to get the monsters to randomly drop rocket ammo (25%); health (25%) or nothing (50%), but my attempts at random drops are not going well and although I did find a topic on the subject, I couldn't understand how to apply it.

My latest attempt was to assign a private 'Drop' variable of random(4) to the monster sprite, then check it's value against 1 and 2 on death, but construct doesn't seem to like the random private variable, and keeps replacing it with 0. Ideally I would generate a random number and check against a single 'drop table' which would make the system much more scalable. Any suggestions please? :)
B
1
G
2
Posts: 2
Reputation: 629

Post » Mon Apr 05, 2010 6:40 pm

Here's an example:
http://dl.dropbox.com/u/529356/Semi%20P ... nItems.cap
v0.99.84

Remember when you use random() it begins at 0, not 1. So random(4) will give you 0, 1, 2, and 3.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon Apr 05, 2010 8:37 pm

Thanks; I can't open that file, Construct returns 'out of memory'.

I'm running ver 0.99.62 which claims to be the latest version. There's no way I shouldn't have enough memory - any suggestions?

EDIT:
Never mind, I've found the latest unstable build on the forums.

I get it now - thanks! :)
B
1
G
2
Posts: 2
Reputation: 629


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests