What i mean to say, im doing a game like contra, i want to shoot bullets from my gun. I only have the sprites of shooting, but not the bullets coming out. If you can help me, im really going to appreciate that. Thanks!
Offline
It's a little bit complicated, but my Tanks project has some scripts for that. Just download it and take a look. It's got scripts for you shooting, and enemies shooting as well. If its too complicated and jumbles together for you, the next level has a simpler script for the same thing. Hope this helps:).
Offline
Scripting just one (reusable) bullet is the easiest, but makes rapid fire basically impossible. On the other hand, one can use multiple bullet sprites to achieve a "machine-gun" type of fire, but it is more complicated. For single-bullet fire, use this script in the bullet sprite:
when gf clicked hide forever if<mouse down?> show go to [gun v] point towards [mouse pointer v] repeat until <<touching [edge v]?> or <touching [enemy v]?>> move (10) steps end hide if<touching [enemy v]?> broadcast [kill enemy v] end
Last edited by MoreGamesNow (2012-04-12 21:23:55)
Offline
First of all, his script is simpler than the first Tanks level, so for times sake, you should probably use that. Secondly, I forgot about rapid fire. To do that, you would just make copies of the bullet sprite, and then, in between forever if, and show, you would put wait any amount of seconds. Depending on how rapid the fire rate is. In between the wait block and the show block, put an if block that says, if not mouse down, stop script. To prevent all the bullet from flying regardless of if you want to stop shooting.
Offline
thanks, but, im not doing an FPS, what im doing is a platform. It s just horizontal bullets, but my true problem is to repeat the bullets and doing it with ammo. When ammo reach zero, i reload, but when i start again, the images of bullets dont come out again. I dont know why, but the action of shooting is ok. The problem is just for the bullet sprite. Thanks!
Offline
when gf clicked hide forever if<<mouse down?> and <(ammo) > [0]>> change [ammo v] by (-1) show go to [gun v] repeat until <<touching [edge v]?> or <touching [enemy v]?>> change x by (10) end hide if<touching [enemy v]?> broadcast [kill enemy v] end
Offline