Itchy_Nipples Posted June 18, 2015 Share Posted June 18, 2015 Hey guys, I've made a generic shooter, you control a ship at the bottom of the screen, an enemy sprite will come down, you fire at it, get a point if you kill it, pretty basic stuff, but for the first game it's something to learn the basics. So far I'm having trouble implementing a feature that I'd like to add. Every 100 points or so, I'd like to see the enemy sprite get faster and faster, to add some difficulty. Here's the code I have having the enemy chase the player: if player1y < player0y then player1y = player1y + 1 if player1y > player0y then player1y = player1y - 1 if player1x < player0x then player1x = player1x + 1 if player1x > player0x then player1x = player1x - 1 Now that code worked and I'd like to add some difficulty (faster enemies after so many points) -- Here is what I tried and it didn't work: if score < 100 then player1y < player0y then player1y = player1y + 1 if score < 100 then player1y > player0y then player1y = player1y - 1 if score < 100 then player1x < player0x then player1x = player1x + 1 if score < 100 then player1x > player0x then player1x = player1x - 1 if score > 100 then player1y < player0y then player1y = player1y + 2 if score > 100 then player1y > player0y then player1y = player1y - 2 if score > 100 then player1x < player0x then player1x = player1x + 2 if score > 100 then player1x > player0x then player1x = player1x - 2 In theory this should've worked, but it didn't. I've tried other miscellaneous things but this is the major change I've made. Is there something I'm missing? Any help about this would be highly appreciated. Quote Link to comment Share on other sites More sharing options...
Mountain King Posted June 18, 2015 Share Posted June 18, 2015 I think you just need to replace "then" with "&&". Both conditions need to happen in order for the player to speed up. if score < 100 && player1y < player0y then player1y = player1y + 1if score < 100 && player1y > player0y then player1y = player1y - 1if score < 100 && player1x < player0x then player1x = player1x + 1if score < 100 && player1x > player0x then player1x = player1x - 1if score > 100 && player1y < player0y then player1y = player1y + 2if score > 100 && player1y > player0y then player1y = player1y - 2if score > 100 && player1x < player0x then player1x = player1x + 2 if score > 100 && player1x > player0x then player1x = player1x - 2 Quote Link to comment Share on other sites More sharing options...
bogax Posted June 18, 2015 Share Posted June 18, 2015 (edited) score is a three byte, six decimal (BCD) digit variable. the bytes are in reverse order, the least significant byte has the highest address try this edit: oops (fixed) rem give the second byte of the score a name dim scr_hundreds = score + 1 if player1y < player0y then player1y = player1y + scr_hundreds + 1 if player1y > player0y then player1y = player1y - scr_hundreds - 1 if player1x < player0x then player1x = player1x + scr_hundreds + 1 if player1x > player0x then player1x = player1x - scr_hundreds - 1 Edited June 18, 2015 by bogax 1 Quote Link to comment Share on other sites More sharing options...
Itchy_Nipples Posted June 18, 2015 Author Share Posted June 18, 2015 I'm probably implementing this wrong into my code, but I'm getting a compile error: DASM V2.20.07, Macro Assembler (C)1988-2003 bytes of ROM space left 2094 bytes of ROM space left 2094 bytes of ROM space left --- Unresolved Symbol List scr_hundreds 0000 ???? (R ) Fatal assembly error: Source is not resolvable. Errors were encountered during assembly Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted June 18, 2015 Share Posted June 18, 2015 Related link: randomterrain.com/atari-2600-memories-batari-basic-commands.html#check_score Quote Link to comment Share on other sites More sharing options...
bogax Posted June 18, 2015 Share Posted June 18, 2015 (edited) I'm probably implementing this wrong into my code, but I'm getting a compile error: DASM V2.20.07, Macro Assembler (C)1988-2003 bytes of ROM space left 2094 bytes of ROM space left 2094 bytes of ROM space left --- Unresolved Symbol List scr_hundreds 0000 ???? (R ) Fatal assembly error: Source is not resolvable. Errors were encountered during assembly post your code you can also refer to the second byte of score as score[1] so you could try something like this temp1 = score[1] + 1 if player1y < player0y then player1y = player1y + temp1 if player1y > player0y then player1y = player1y - temp1 if player1x < player0x then player1x = player1x + temp1 if player1x > player0x then player1x = player1x - temp1 Edited June 18, 2015 by bogax 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.