chickenxhat Posted July 28, 2013 Share Posted July 28, 2013 Hey all. First post, first game, first question. I'd like to make a simple two-player fighting game. I have 2 player sprites controllable on screen, a background, and now I just need to define some things such as the edges of the screen where the players bump into, bumping into eachother, and add a missile-based punch function, and collision between those missiles and the two players. attached is my (likely rough) code, everything working up to the point where I need to add the things described. As far as work flow goes, I've gotten to the point where I need to figure out and add collision detection, and I haven't yet begun exploring the missile system, but help with both would be very valuable to me. So far I've seen lots of complicated examples of collision detection, where the playing field wasn't a solid block that the players appear in front of (like my game), and included X and Y axis movement. I only require X axis movement, so I only require X axis collision detection, and between a total of 4 (or 6, including the edges of the screen) objects. I feel as though I understand what needs to be coded, but I'm not sure how to do it without making things far more complicated than I perceive that they need to be. in psuedo code: if collision(player0, player1) then player0 can't move right and player1 can't move left if collision(player0, left edge of screen) then player0 can't move left if collision(player1, right edge of screen) then player1 can't move right I think I read under random terrain's tutorial stuff that only standard objects like player1, missile0, etc are valid arguments in the collision/!collision statements. how do I work around this? I'd be really stoked to find out that the required work is easy, but if it required defining several constants or dimensions and includes checks and calls in the main loop.. can someone help spell it out for me? I really appreciate any help on this one. Lincoln Fight.bas Quote Link to comment Share on other sites More sharing options...
chickenxhat Posted July 29, 2013 Author Share Posted July 29, 2013 well.. I figured it out I guess. I also added NUSIZ0/NUSIZ1 functionality to fill the screen with the two fighters. I've noticed however that when I remove "const noscore = 1" from the form that NUSIZ0/NUSIZ1 functionality fails to work. Why is this? How do I get around it? I intended to use the left and ride score areas as health bars for the two Lincolns. I'd also intended to use missile functionality as a "punch" with collision causing damage to other player, though it seems I can't make a missile higher than 1 pixel. Is this truly the case? I know I can increase its length (again, with NUSIZ0/NUSIZ1 functionality) but I can't make it 4 pixels high as well? If not, I guess I need to move on to animating the sprites. I'd like each player's sprite to change upon pressing "fire" to show an extended arm punching (which will have to fit into the 8 pixel wide sprite area, albeit increased to 32 pixels with NUSIZ0/NUSIZ1). Lincoln Fight.bas Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted July 29, 2013 Share Posted July 29, 2013 You might want to ask a moderator to move this thread to the batari Basic forum: atariage.com/forums/forum/65-batari-basic/ Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted July 29, 2013 Share Posted July 29, 2013 well.. I figured it out I guess. I also added NUSIZ0/NUSIZ1 functionality to fill the screen with the two fighters. I've noticed however that when I remove "const noscore = 1" from the form that NUSIZ0/NUSIZ1 functionality fails to work. Why is this? How do I get around it? I intended to use the left and ride score areas as health bars for the two Lincolns. NUSIZ0 and NUSIZ1 need to be in your main loop, not in the initialization section: http://www.randomter...ands.html#nusiz I'd also intended to use missile functionality as a "punch" with collision causing damage to other player, though it seems I can't make a missile higher than 1 pixel. Is this truly the case? I know I can increase its length (again, with NUSIZ0/NUSIZ1 functionality) but I can't make it 4 pixels high as well? If not, I guess I need to move on to animating the sprites. I'd like each player's sprite to change upon pressing "fire" to show an extended arm punching (which will have to fit into the 8 pixel wide sprite area, albeit increased to 32 pixels with NUSIZ0/NUSIZ1). Have you looked at this section: http://www.randomter...s.html#missiles As far as I know, you can use missile0height to make a missile as high as 255 pixels. lincoln_fight_2013y_07m_29d_1605t.bas Quote Link to comment Share on other sites More sharing options...
chickenxhat Posted July 30, 2013 Author Share Posted July 30, 2013 RT - you rock, very hard. I really appreciate you taking the time to check out my code, and to make some needed changes (and cleaning/grouping). Many thanks. Over the past day I've made some general changes, and now I've incorporated the concepts you've shown me. I'm no longer using the missile function as a punch, and instead animate the sprites and use collision && joyXfire to initiate punches. That plus moving NUSIZx to the mainloop means I can use the score again with my cleaned up playfield and character functionality. So far its looking great! (see attached code). Next up I need to debounce the joyXfire buttons so that players are set to !joyXfire after pressing the button (and after causing the necessary actions that joyXfire && collision are designed to do). So far I've only seen mega-complicated calls/dimensions/bits/etc. I'm struggling with it. Any simplification of this would be rad. In the mean time, I'm gonna work on punches causing damage. Stoked! And at this point, and for what its worth.. RT, you deserve co-author credit for this game. Lincoln Fight.bas Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted July 30, 2013 Share Posted July 30, 2013 See if this is what you want: lincoln_fight_2013y_07m_30d_0331t.bas lincoln_fight_2013y_07m_30d_0331t.bin Quote Link to comment Share on other sites More sharing options...
chickenxhat Posted July 31, 2013 Author Share Posted July 31, 2013 (edited) Yes! Almost! Thats the gameplay mechanics I want, but I can't seem to find a way inside that code to reset the sprite from punching to normal while the button is still held. Bah! Working on it. edit: after further playtesting, and some code editing, i notice that the Lincolns (while mid-field) do anime-style lightspeed punches, but when one is against the wall, the other's punches work perfectly, deactivating when the should and not rapidly repeating. I'm pouring over the code trying to find a way out of that loop. RT'sCodeedited.bas Edited July 31, 2013 by chickenxhat Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted July 31, 2013 Share Posted July 31, 2013 I should have something within 30 minutes. Quote Link to comment Share on other sites More sharing options...
chickenxhat Posted July 31, 2013 Author Share Posted July 31, 2013 rad. another note: when joy0right player1 can't move left. i should be a playtester! Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted July 31, 2013 Share Posted July 31, 2013 Of course, the second I go to upload, the AtariAge web site decides to go bye-bye for a few minutes. I used the program that I already had instead of the one you posted: lincoln_fight_2013y_07m_31d_0315t.bas lincoln_fight_2013y_07m_31d_0315t.bin I made a few changes including _P0_Punch_Counter and _P1_Punch_Counter. They determine the speed of the punch for each player. I set them at 10, but you can change the numbers to match the speed you want. Quote Link to comment Share on other sites More sharing options...
chickenxhat Posted July 31, 2013 Author Share Posted July 31, 2013 Random Terrain +1 thanks for the guidance. i feel like i actually understand what you did for my code/game. author credit. now to work on sfx. Lincoln Fight.bas Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted July 31, 2013 Share Posted July 31, 2013 now to work on sfx. If that means sound effects, you can use simple ones like these: http://www.randomter...xamples_no_data Or more complex ones like these: http://www.randomter...example_no_bank If you are using Visual batari Basic, it comes with Tone Toy 2008 and that can help you find sounds that you might want to use. You can also use VbB's Music and Sound Editor to make complex sound effects and music. Quote Link to comment Share on other sites More sharing options...
chickenxhat Posted August 2, 2013 Author Share Posted August 2, 2013 (edited) So.. game was looking pretty good up until a point where I was installing and running on different builds (trying to get sound and music editor to work). now that i've gone back to the original build I was using my nearly finished (to my standards and goals) game simply won't compile anymore. And when I open a recent version, not only is it missing a day's worth of work, but it seems my custom score font has disappeared. That much I can fix, but what happened to my game? if its something wrong with my code, could someone check it out? here's the error message: Compile started at 8/2/2013 12:16:12 AM Compiling (XXXXXXXX) DASM V2.20.07, Macro Assembler ©1988-2003 Lincoln Fight RC1point0.bas.asm (1884): error: Syntax Error '#$O0'. bytes of ROM space left Unrecoverable error(s) in pass, aborting assembly! Complete. Errors were encountered during assembly. 2600 Basic compilation completed. i'm using build 1.0 554 and every other project i compile works but this one. such a generic and uninformative error code. bah! Lincoln Fight RC1point0.bas Edited August 2, 2013 by chickenxhat Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted August 2, 2013 Share Posted August 2, 2013 You might want to look at this new thing I added to the bB page if you haven't already: http://www.randomter...ts_of_a_program Looks like this was the problem: COLUP1 = $O0 You had a capital O and a zero instead of 2 zeros. lincoln_fight_rc1point0_2013y_08m_02d_0351t.bas Quote Link to comment Share on other sites More sharing options...
chickenxhat Posted August 2, 2013 Author Share Posted August 2, 2013 Well.. that's embarassing. Always helpful, thanks RT. 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.