Mort Posted April 25, 2006 Share Posted April 25, 2006 (edited) Hello everyone, I've started working on my first game and am just trying to get things to move around properly. I can get player 1 to move correctly, but when I set the if block for player 2's movement, DASM throws an Unresolved Symbol List error that looks like this --Unresolved Symbol List ROM2k 0000 ???? ® joy1left 0000 ???? ® NO_ILLEGAL_OPCODES 0000???? ® joy1down 0000 ???? ® joy1right 0000 ???? ® joy1up 0000 ???? ® --- 6 Unresolved Symbols It goes through the basic --> assembly compiler just fine, just hangs on DASM. Anywho, here's my code. init x = 40 : y = 20 v = 145 : w = 75 c = 0 scorecolor = 14 mainloop COLUP0 = 112 COLUP1 = 64 c = c + 1 if c > 15 then anim player0: %00101000 %00010000 %00111000 %01010100 %00111000 %01111100 %00111000 %00010000 end player1: %00101000 %00010000 %00111000 %01010100 %00111000 %01111100 %00111000 %00010000 end goto paint anim player0: %00101000 %00010000 %01111100 %00010000 %00111000 %01111100 %00111000 %00010000 end player1: %00101000 %00010000 %01111100 %00010000 %00111000 %01111100 %00111000 %00010000 end if c > 29 then c = 0 paint player0x = x : player0y = y player1x = v : player1y = w drawscreen if joy0up then y = y - 1 if joy0down then y = y + 1 if joy0left then x = x - 1 if joy0right then x = x + 1 if joy1up then w = w - 1 if joy1down then w = w + 1 if joy1left then v = v - 1 if joy1right then v = v + 1 goto mainloop Demolition1.bas Edited April 26, 2006 by Mort Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/ Share on other sites More sharing options...
+batari Posted April 25, 2006 Share Posted April 25, 2006 Hello everyone, I've started working on my first game and am just trying to get things to move around properly. I can get player 1 to move correctly, but when I set the if block for player 2's movement, DASM throws an Unresolved Symbol List error that looks like this --Unresolved Symbol List ROM2k 0000 ???? ® joy1left 0000 ???? ® NO_ILLEGAL_OPCODES 0000???? ® joy1down 0000 ???? ® joy1right 0000 ???? ® joy1up 0000 ???? ® --- 6 Unresolved Symbols It goes through the basic --> assembly compiler just fine, just hangs on DASM. I assume you are using 0.35, in which I forgot to add the routines for joystick 1. To fix, either use one of the latest builds, or if you want to use 0.35, you can stilll do so if you replace the existing std_routines.asm with the one I've attached here. std_routines.zip Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1056616 Share on other sites More sharing options...
Mort Posted April 25, 2006 Author Share Posted April 25, 2006 (edited) Thanks a bunch, batari, that did the trick! Just as an aside, I went on ahead and updated to the bleeding edge 99, which also fixed problems I was having with my include div_mul.asm statement. Edited April 25, 2006 by Mort Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1056627 Share on other sites More sharing options...
Mort Posted April 26, 2006 Author Share Posted April 26, 2006 Ok, I've been working on my game and have made a good deal of progress. You can drop boxes by changing the playing field squares, I put a cap on how fast boxes are dropped, made it so you can "slide" boxes ontop of pre-existing boxes (if you drop a box and there's already a box in the way, it will drop it in the next available playing field sqare) and made it so that boxes are dropped in the direction you were last facing. Now I'm ready to try collision detection with the playing field I made some collision detection, but it doesn't work correctly. If you're just moving in the cardinal directions, it's fine, but when you move in diagonals, you can sneak through boxes. Idealy, I would like for the player to just stop when they run into a box, no matter which direction they're going. Anyone have ideas as to how I could stop the diagonal sneakage? Another possibility would be to limit the player to only moving in the cardinal directions. I think I saw a thread where someone else managed to do this, does anyone know how to accomplish this as well? Code is attatched. Construction6.bas Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1057255 Share on other sites More sharing options...
+batari Posted April 26, 2006 Share Posted April 26, 2006 Ok, I've been working on my game and have made a good deal of progress. You can drop boxes by changing the playing field squares, I put a cap on how fast boxes are dropped, made it so you can "slide" boxes ontop of pre-existing boxes (if you drop a box and there's already a box in the way, it will drop it in the next available playing field sqare) and made it so that boxes are dropped in the direction you were last facing. Now I'm ready to try collision detection with the playing field I made some collision detection, but it doesn't work correctly. If you're just moving in the cardinal directions, it's fine, but when you move in diagonals, you can sneak through boxes. Idealy, I would like for the player to just stop when they run into a box, no matter which direction they're going. Anyone have ideas as to how I could stop the diagonal sneakage? Another possibility would be to limit the player to only moving in the cardinal directions. I think I saw a thread where someone else managed to do this, does anyone know how to accomplish this as well? Code is attatched. I took a look at the code. The easiest fix would be to limit movement to four directions by simply skipping the rest of the joystick reads once a valid direction is found. If you want to allow diagonals, probably the easiest way would be to remember which of the 8 directions you moved last, and if there's a collision, just move the player the opposite way. Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1057304 Share on other sites More sharing options...
SeaGtGruff Posted April 26, 2006 Share Posted April 26, 2006 I made some collision detection, but it doesn't work correctly. If you're just moving in the cardinal directions, it's fine, but when you move in diagonals, you can sneak through boxes. Idealy, I would like for the player to just stop when they run into a box, no matter which direction they're going. Anyone have ideas as to how I could stop the diagonal sneakage? Another possibility would be to limit the player to only moving in the cardinal directions. I think I saw a thread where someone else managed to do this, does anyone know how to accomplish this as well? I took a look at the code. The easiest fix would be to limit movement to four directions by simply skipping the rest of the joystick reads once a valid direction is found. If you want to allow diagonals, probably the easiest way would be to remember which of the 8 directions you moved last, and if there's a collision, just move the player the opposite way. First of all, I notice that the collision detection seems to be fine if the movement is in certain diagonal directions, such as up and left, so you should look at how that situation is being handled, versus the way the other situations are being handled. I haven't studied your code yet, but batari's comment about keeping track of your last direction is the way I did it in my unfinished Reventure game. First, I moved the man in one frame, and saved the x and y directions, then at the start of the next frame I checked for a collision between the man (player0) and the playfield, and if one occurred, I moved the man back in the opposite x and y directions, like this: dim horizontal_motion = h dim vertical_motion = v dim hero_x = x dim hero_y = y hero_x = 93 hero_y = 51 horizontal_motion = 0 vertical_motion = 0 loop player0x = hero_x player0y = hero_y drawscreen if !collision(player0,playfield) then not_touching_wall hero_x = hero_x - horizontal_motion hero_y = hero_y - vertical_motion not_touching_wall horizontal_motion = 0 vertical_motion = 0 if joy0left then horizontal_motion = 255 if joy0right then horizontal_motion = 1 if joy0up then vertical_motion = 255 if joy0down then vertical_motion = 1 hero_x = hero_x + horizontal_motion hero_y = hero_y + vertical_motion goto loop Obviously, the above code is incomplete, but it should give you an idea of how I did it. In particular, you must check for a collision and bump the man back *before* you determine the new values for the x and y movements, so you can apply the opposite of the previous movements before moving again, if you see what I mean. I've made a few changes in your code, but just for player0, and now the collision detection works better. Unfortunately, the code still needs work, because if player0 drops a new block, he can get stuck on it! But hopefully you can tinker with the code to get my changes working correctly. Michael Rideout Construction6.bas Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1057340 Share on other sites More sharing options...
Mort Posted April 28, 2006 Author Share Posted April 28, 2006 Thanks to the both of you, I got my collision detection working just fine. The player being trapped by a box is actually a good thing, I turned that into a win condition. "It's not a bug, it's a feature!" The game is almost done, I have about....90 bytes left on the ROM and am trying to get a sound effect for the boxes to work right currently. Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1058423 Share on other sites More sharing options...
Piggles Posted September 4, 2006 Share Posted September 4, 2006 Though this is an old thread, I want to just extend my thanks to Mike Rideout for his explanation of collision because it came in handy for me today. It's good to have these forums. Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1132276 Share on other sites More sharing options...
SeaGtGruff Posted September 5, 2006 Share Posted September 5, 2006 Though this is an old thread, I want to just extend my thanks to Mike Rideout for his explanation of collision because it came in handy for me today. You're welcome! I'm glad it was helpful. It's good to have these forums. I concur! MR Quote Link to comment https://forums.atariage.com/topic/86960-a-new-problem-collision-detection-between-players-and-playing-field/#findComment-1132429 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.