Zereox Posted October 13, 2007 Share Posted October 13, 2007 How can I disable the player to press on the fire button more then one. EX:jump five pixel high then wait for landing to be able to jump again. Quote Link to comment Share on other sites More sharing options...
+atari2600land Posted October 13, 2007 Share Posted October 13, 2007 (edited) How about the following code: if joy0fire && !a{1} then a{0}=1 if joy0fire && a{0} then a{0}=1 if a{0} then player0y=player0y-1 : b=b+1 if b=5 then a{0}=0 : a{1}=1 : b=0 if a{1} then player0y=player0y+1 if collision(playfield,player0) then a{1}=0 There are many factors to consider though. First off, is your player jumping and landing on a strip of playfield or not? Secondly, which player is jumping? If it's player1 (or above), then you need to change the player # accordingly (in this code, player0). And if the variables a and b are being used presently in your code, change them to variables that aren't. And, of course, how about posting what you have so far so we can take a better look at it? EDIT: A little jumping program with the following code at work. I changed b to equal 15 before the jumping down part happens. jump.bas Edited October 13, 2007 by atari2600land Quote Link to comment Share on other sites More sharing options...
SeaGtGruff Posted October 13, 2007 Share Posted October 13, 2007 How can I disable the player to press on the fire button more then one.EX:jump five pixel high then wait for landing to be able to jump again. One option is to use a debounce routine. Basically, you define a variable (a counter) that you'll automatically decrement each frame if it isn't equal to 0-- or, if it's already equal to 0, then you leave it alone. This will be the debounce counter. When the player presses the fire button, you check the debounce counter. If it isn't equal to 0, that means the debounce counter is still counting down, so you ignore the fire button; otherwise, if it's equal to 0, you set it to the desired debounce value (i.e., the number of frames you want to wait before allowing the fire button to function again), and then do whatever you want to do when the fire button has been pressed. However, that works on a time basis, so it won't keep them from pressing the fire button again once the debounce period has elapsed. If you want to wait until after the player lands before letting him jump again, you will need some sort of flag to indicate whether the player is on the ground or in the air. Assuming that "on the ground" means the sprite is colliding with the playfield, then you could use the appropriate collision register as the flag-- if there's no collision, then the player must be up in the air, so ignore the fire button. Michael Quote Link to comment Share on other sites More sharing options...
Zereox Posted October 14, 2007 Author Share Posted October 14, 2007 Ok thanks to both of you here is the code + the .bin. This game is called Barrel Jumper pretty straight forward you just have to jump over a barrel as it passes. Features: Increase barrel speed Jumping Animation Score and Damage(damage has bad collision I might need help on that) All of the credits are in the .bas please leave comment this is my first game. Quote Link to comment Share on other sites More sharing options...
gambler172 Posted October 14, 2007 Share Posted October 14, 2007 Hi Nice idea,but after some time,the barrels become really fast. greetings Walter Quote Link to comment Share on other sites More sharing options...
Zereox Posted October 14, 2007 Author Share Posted October 14, 2007 (edited) Ok thanks. Speed was fixed Collision was fixed to-do Add additon barrel I really need help when i want to add a extra barrel what do I do because player2 doesn't exist neither does enemy0 what do I call my enemy sprite. Here is 3 files One with Fix above + .bin + Files with try to add 2 barrel barrel_Jumper.bas barrel_Jumper.bas.bin barrel_Jumper_uncompilable.bas Edited October 14, 2007 by Zereox Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.