Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Thank you bogax, that was awesome of you =) Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 No need for me to post a fix. Two of your ifs have a capital I. Fix that and it will work. If = bad if = good Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Haha, thanks Random Terrain! I did not see that. That just goes to show how easy it is to make mistakes =) 1 Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Another question: I want player1 to be randomly placed on the playfield, but only in the pfpixel "grid". of pfpixels12-21 across and 3-9 vertical. Would it be easiest to do this with a t=rand&15) event? Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Yeah I got it working with a random counter. But I suck at math. Player1 is 7 pixels tall and 4 wide. I calculated the x placement perfectly. But I'm having problem wit the y placements. If I want it to go down it's own length 1 time would that be +8 or +9? +7 wasn't quite right it turned out. Quote Link to comment Share on other sites More sharing options...
bogax Posted January 18, 2015 Share Posted January 18, 2015 Another question: I want player1 to be randomly placed on the playfield, but only in the pfpixel "grid". of pfpixels12-21 across and 3-9 vertical. Would it be easiest to do this with a t=rand&15) event? ranged rand (sorry, freehosting with ads) Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Cheers! Got it working perfectly now. Man, I'm so glad everything is getting together now. Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 A question about this code again. It appears that it works when player0 is next to the dragon, which is great. But even if player1 is all the way across the playfield and player0 is at the bottom it registers as long as they are nex ´t to each other. How would I fix it so it takes the y value into account aswell? if player0x > player1x then _dragon_xpos = player0x - player1x : if _dragon_xpos < 5 then COLUPF=$DA : goto __Skip_Proximity if player1x > player0x then _dragon_xpos = player1x - player0x : if _dragon_xpos < 5 then COLUPF=$DA : goto __Skip_Proximity if player0y > player1y then _dragon_ypos = player0y - player1y : if _dragon_ypos < 5 then COLUPF=$DA : goto __Skip_Proximity if player1y > player0y then _dragon_ypos = player1y - player0y : if _dragon_ypos < 5 then COLUPF=$DA __Skip_Proximity Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 How much have you changed since last time? This is what I did to the last uploaded version: d_and_d_demo_2015y_01m_17d_2303t.bas d_and_d_demo_2015y_01m_17d_2303t.bin I was working on that while you guys were posting back and forth. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 About your last question, try this: if player0x > player1x then _dragon_xpos = player0x - player1x : if _dragon_xpos < 5 then COLUPF=$DA : goto __Skip_X_Check if player1x > player0x then _dragon_xpos = player1x - player0x : if _dragon_xpos < 5 then COLUPF=$DA __Skip_X_Check if player0y > player1y then _dragon_ypos = player0y - player1y : if _dragon_ypos < 5 then COLUPF=$DA : goto __Skip_Proximity if player1y > player0y then _dragon_ypos = player1y - player0y : if _dragon_ypos < 5 then COLUPF=$DA __Skip_Proximity Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Neat changes =) I have been adding some new stuff. Like the dragon being randomly placed with a rand counter so it is always placed along the grid. It's very memory heavy but works like a dream! =) DnD04.bas Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 (edited) Hm, I still get the same problem. I'm thinking it's a math thing. I've fiddled with the numbers and almost got it working once. I'm sure it's this part that needs figuring out what number it needs: if _dragon_xpos < 4 If I only was better at understanding math Edited January 18, 2015 by Retro Lord Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 Be sure to compare my code with yours and see if you want to keep any of the changes. For example, I got rid of reboot since it can ruin random numbers: randomterrain.com/atari-2600-memories-batari-basic-commands.html#reboot Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Ahh, good to know, thanks! Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Okay, I've almost fixed it. This parts now works: if player0x > player1x then _dragon_xpos = player0x - player1x : if _dragon_xpos < 8 then COLUPF=$DA : goto __Skip_X_Check if player1x > player0x then _dragon_xpos = player1x - player0x : if _dragon_xpos < 5 then COLUPF=$DA __Skip_X_Check Now I just have to find the right numbers for the y position Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 I dunno, it seems like nothing I do quite works with that code. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 I dunno, it seems like nothing I do quite works with that code. Maybe you could explain in better detail exactly what is supposed to be happening. If COLUPF isn't changing color, you might be overriding it somewhere else. Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Well, the issue is that I just can't get the code to do what I want. The 2 first lines are working.(I think) The bottom part not really. What I'm after is, if player1 is either directly left, right, above or below the color change initiates. As it is now the color changes if player0 is left, right, above or below without regard for how close they are too each other. if player0x > player1x then _dragon_xpos = player0x - player1x : if _dragon_xpos < 8 then COLUPF=$DA : goto __Skip_Proximity if player1x > player0x then _dragon_xpos = player1x - player0x : if _dragon_xpos < 5 then COLUPF=$DA : goto __Skip_Proximity if player0y > player1y then _dragon_ypos = player0y - player1y : if _dragon_ypos < 3 then COLUPF=$DA : goto __Skip_Proximity if player1y > player0y then _dragon_ypos = player1y - player0y : if _dragon_ypos < 3 then COLUPF=$DA : goto __Skip_Proximity __Skip_Proximity Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 Before I work on this, do I have the latest version or have you made a bunch of new changes? Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Good that you asked. I've made a bunch of changes. I worked on everything else since this was the only part I couildn't figure out. Source - d_and_d_0.4.1.bas Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 OK, now don't change anything else and I'll see if I can get it working right. Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 18, 2015 Author Share Posted January 18, 2015 Thank you so much. I don't know how I'm gonna repay all the help I've gotten =) Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted January 18, 2015 Share Posted January 18, 2015 This seems to be working unless I misunderstood:d_and_d_0.4.1_2015y_01m_18d_0445t.basd_and_d_0.4.1_2015y_01m_18d_0445t.binLike I had in the other version I posted, the code to place the dragon is fairly small:_ ;*************************************************************** ; ; Sets up random dragon location. ; (_PF_LR and _PF_UD can be used here temporarily because ; they are set up AFTER this.) ; _PF_LR = (rand/64) + (rand&3) + (rand/64) + 11 _PF_UD = (rand/64) + (rand&3) + 2 player1x = (_PF_LR * 4) + 16 player1y = (_PF_UD * + 8 _Now you don't need all of the if-thens to place the dragon. Here's a test program where you can press reset over and over to see the random placement of the dragon:reset_test_2015y_01m_18d_0445t.binI also put the dims near the beginning of the program so they can be found as quickly and easily as possible. Speaking of dims, if you use dim to make an alias for every variable used in the program, you or anyone editing your program won't have to worry that a variable is already used somewhere deep in the code. In case you were wondering, mixing up division and & seems to make the random numbers more spread out and not start in the same place, at least with Stella anyway. Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 19, 2015 Author Share Posted January 19, 2015 Thank you so much, that was exactly what I was going for =) Quote Link to comment Share on other sites More sharing options...
Retro Lord Posted January 19, 2015 Author Share Posted January 19, 2015 Though I get a ton of warnings from your code. If I assemble and run it the screen is completely black with a few white lines. 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.