I'm making a game with mmf2 for a final project in an online game desgin class. Im making a sidescrolling zombie shooter. Anyways i need help with something very important. I have only been using this software for about a month so i dont know much. My problem is my guns will shoot as fast as you can press the spacebar. Can someone please help me with a simple way to limit how fast your guns shoot and how much bullets are in a clip? My pistol will have unlimited ammo but i want 7 bullets in a clip can someone please help me?
never done this but im guessing you can just set a counter... every time u shoot the counter goes +1. when it reaches 7 u make a reload event or whatever.
and for the timing of the shots u could probably use a timer. never have used one so im not sure they work like that... again u could prob use a counter though
i didnt think much about it but it should be quit simple
You can do like this.
Create a counter and call it "Timer".
Set initial value of Timer to 50.
Then, write this code :
+ When Timer is <50
° Add 1 to Timer
+ When "Space Bar" is pressed
+ When Timer is = 50
° Shot the Bullet
° Set Timer to 0
So.. you begin with your weapon ready to shot.
Every time you shot, the counter will be set to 0 and so you have to wait until it reach 50 to shot again.
If you think think that the gun is still shooting too fast, then you can replace the number 50 with an higher number.
If you think that the gun is now shooting too slow, you have to replace number 50 with a low number.
Obviously you don't have to rename your counter as Timer if you don't like it.
You can choose any name.. it doesn't matter
And for the reload thing, Daka system should work well
Ok, I`m not sure about this so correct me if I`m wrong but can´t you just add a "every XX" condition to your event were "XX" is the delay time you want in between each shot? ..that is if you have a "while key is being pressed down" event.
Originally Posted by ]Alpha[ You can do like this.
Create a counter and call it "Timer".
Set initial value of Timer to 50.
Then, write this code :
+ When Timer is <50
° Add 1 to Timer
+ When "Space Bar" is pressed
+ When Timer is = 50
° Shot the Bullet
° Set Timer to 0
So.. you begin with your weapon ready to shot.
Every time you shot, the counter will be set to 0 and so you have to wait until it reach 50 to shot again.
If you think think that the gun is still shooting too fast, then you can replace the number 50 with an higher number.
If you think that the gun is now shooting too slow, you have to replace number 50 with a low number.
Obviously you don't have to rename your counter as Timer if you don't like it.
You can choose any name.. it doesn't matter
And for the reload thing, Daka system should work well
Edited by the Author.
THANK YOU SO MUCH!!! it worked, i set it to 25 though. What is the daka system
// fire if there's enough ammo loaded
+ repeat while <fire button> is pressed
+ restrict actions for <insert delay between shots here>
+ ammo_counter > 0
-> subtract 1 from ammo_counter
// when out of ammo, add a delay while reloading
+ ammo_counter = 0
-> add 1 to reload_delay_counter
// finish reloading after this delay
+ reload_delay_counter = <whatever delay you want>
-> set reload_delay_counter to 0
-> set ammo_counter to 7
Lönnemyr: You usually don't want to use the "every..." condition. In most cases "restrict actions for..." is better.
The difference is this - "every" events are repeated at regular intervals after the start of the frame. As a result, the actual delay between the conditions being true and the action occurring, is not always constant.
"Restrict actions" events are repeated at an interval after they last occurred.
thanks for all the help. I have been working on it some more and encountered several more problems. I tried to fix it myself but i can't figure it out so i'll ask here again since last time was so helpful. Okay so im making a 2d sidescrollin zombie shooter for a final project in my game design class and i would really appreciate some help. I'm gonna try to make this as detailed as possible.
1) I made a H.U.D of 2 active objects and 2 counters. One counter is the health, its a bar with a gradient that goes green to red. One counter is the bullet counter, just numbers. One active object is the moon, not really part of the hud but i want the moon to scroll with it. And one active object is the bullet icon. The hud is in the top left corner of the screen. Now when the player reaches the middle of the screen the screen starts to scroll with the player because i set it to always>scrollings> scroll to Player 1> 0,0 relative or something like that. The problem is the counters scroll with the player and screen but the bullet icon and moon are left behind. They are active objects that are static. How can i make it scroll with the player?
2) When the reload animation starts i want it to play the reload sound as the player is reloading. So i make a new condition that says player1 is in the reload animation. then in the sound box i select play sample sound and i choose the reload sound. When i test this in the game the sound goes all crazy and messed up and the music stopps playing and all the sound in the game just changes terribly, it kindof sounds like when your tv has no reception. But when i put the sound to play anywhere else like after he is done reloading it plays fine. Can anyone help me out with this?
3) I'm not sure how to do the a certain part of the combat. The zombie is bouncing ball motion and the main character is platform movement. I'm not sure what to do when the main character gets hit by the zombie. right now the main character plays a little animation of getting hit and he gets pushed back a little bit. It looks really awkward though because it looks like he disappears and reappears a little further back. Does anyone know how to make the combat between the character and zombie better?
i might post a youtube video showing this if noone understands me. I've only been using this for about a month so im sorrry for asking so many questions but if i can fix these few but irritating problems i don't see anything else that can stop the production of my game.Any help at all is appreciated thanks. (Sorry for such a long post)
1.) Go to the objects properties tab and find a new tab named "scrolling" or "display" (or something like that), tick or untick (I don't remember which) the "Follow the Frame" box.
2.) This is probably because your event is repeating continuously while the animation is playing. This causes your game to start playing another instance of the sound effect every 1/50th of a second. You need to insert a "only one action when event loops" condition into the event, and that should fix it.
i finished the first level already. Is there a way to copy and paste everything from the first level and paste it into the second level? I want to just copy everything and paste it into the second level and edit it from there to save time because im running out of time but when i copy and paste into level 2 it looks the same but doesn't act the same is there a way i could copy and paste without having to reprogram the whole thing again and again?
Originally Posted by Jon Lambert In the storyboard editor, right click the level you made and choose copy. Then left click on it (or any other frame) and press Ctrl+V.
Thank you so much. My main character has platform movement and i suck at animating so it looks weird when zombies attack him. Do you know a way to push the character back As if i jumped and went backwards ?
I really appreciate the help ive been getting but i got more problems.
1) So does anyone know how to "Push" my character up and back when he gets hit. Im using default platform movement.
2) I have a health pack feature in the game but i have problems with that too. Here is what i've got. YOu get 3 packs. When youuse one you get a health boost. How do i make it so that when you have zero you cant get anymore health. Right now i have it working but if you press the button and you have none left you still get health. Someone help please!
Originally Posted by Jon Lambert 2) Just add a condition to the event that says "Number of Health Packs > 0"
I moved away from the default platform movement, because of this specific issue. I don't know how to help you.
Here is what i have for my helathpack. Im a bit confused
Healthpack > 0 then Global value D =1
Global Value D= 1, Upon pressing"0" then Subract 1 from health counter, and add 1 to player 1 health.
Healthpacks = 0 then Global value D = 0
Global Value D= 0 then This is where im stuck
Why are you using a global value? Is this some sort of flag to tell MMF that there are either some or none at all? I don't see why this can't be done with just one event.
Event: Player presses "Use healthpack key"
Condition: Healthpack counter > 0
Action: Subtract 1 from healthpack counter, add 1 to player health.
It's saying, if the player presses the key and there is actually more than zero healthpacks, then the player can use one and it will subtract one of the healthpacks for you. If there is 0 left, the condition is void and therefore the event is useless and the action will not take place.
Originally Posted by jthongbai Why are you using a global value? Is this some sort of flag to tell MMF that there are either some or none at all? I don't see why this can't be done with just one event.
Event: Player presses "Use healthpack key"
Condition: Healthpack counter > 0
Action: Subtract 1 from healthpack counter, add 1 to player health.
It's saying, if the player presses the key and there is actually more than zero healthpacks, then the player can use one and it will subtract one of the healthpacks for you. If there is 0 left, the condition is void and therefore the event is useless and the action will not take place.
Thanks i guess i just made it more complicated than it should have been
It's easy to do that
When I first started using TGF and MMF, it took me a long time to become competent at using less events to achieve more actions. After a while I just got used to the way the program works and you try to cram as much as you can into events. (Sometimes biting off more than you can chew )
In my game i have an event to destroy the bullet it goes like this.
When bullet exits screen to the right then destroy bullet.
The problem is the bullet keeps on going and kills enemies you aren't supposed to see yet. Is there another way?
Is it possible to make a backdrop scroll, i know with an active object you just check the "Follow The Frame" box but a backdrop doesn't have that. There is an awesome backdrop of a sunset in the multimedia disc library but it cant scroll with the game. I tried copying the image and then pasting it as an active object but that makes it look weird and distorts it. Can Somebody Please Help?