(request) load and shoot like megaman

Post your own tutorials, guides and demos.

Post » Tue Mar 15, 2011 12:23 am

wanted a tutorial on how to load and shoot like mega-man.
B
1
G
1
Posts: 3
Reputation: 431

Post » Tue Mar 15, 2011 12:31 am

Please stick to english on the forums, thanks!
Moderator
B
87
S
32
G
33
Posts: 3,005
Reputation: 27,397

Post » Fri Apr 01, 2011 1:04 am

that would be awesome to learn!!!
B
1
G
1
Posts: 7
Reputation: 464

Post » Mon Apr 04, 2011 6:47 am

Do you mean charged shots?
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Tue Apr 19, 2011 2:56 pm

you need to make a counter for charged shots. The action of shooting is executed when you're not pressing a particular key. But you'd also need to limit that within the value of a counter so that you're not ALWAYS shooting.

1) when X is pressed constantly, +1 to counter
2) when X is not pressed, while counter is >10, shoot charged shot, limit action to 1 if it loops. Set counter to 0

That's the gist of it. It can become a bit buggy depending on how the loop is defined and how the engine resets the counter.
B
11
G
1
Posts: 21
Reputation: 796

Post » Tue Apr 19, 2011 4:03 pm

You don't need a loop. I'll do an example in a bit.
B
11
S
3
G
8
Posts: 473
Reputation: 4,569

Post » Wed Apr 20, 2011 6:52 pm

Here's a small cap of how I would do it :)

[url:qm8siyt8]http://dl.dropbox.com/u/1289341/charge.cap[/url:qm8siyt8]

By adding timedelta to charge when the charge button is down, it increases charge by essentially 1 per second, so to reach the small charge bullet, you would hold down charge for more than 1 second, but less than 3 etc, so you can change the values I used in the subevents to however many seconds you want to charge for each level of charge.
The other reason I'm using timedelta is because if you did something like, 'add 1 to charge variable', it would add 1 per tick, meaning, people with faster computers could potentially charge their guns faster! Having it add per tick also means each charge level has to be a much higher value (like 60ish for one second of charge time). Timedelta however, behaves the same regardless of frames per second (there are exceptions but we won't go there! ;))

Enjoy! If you need further elaboration, please let me know :)
B
3
S
2
G
5
Posts: 351
Reputation: 2,377


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 0 guests