TheCoffeeFox #1 Posted November 13, 2014 Hi Again! I'm still in the makes for a little game but i need help i had a idea of after getting like 20 points from shooting monsters it could goto a other level and if so could i make it have more monsters spawn I was wondering if this line of code would work if score = score+20 then goto level2 and then a Playfield called level2 i created would load please tell me if that would work and if it would how can i make 1 more monster load? Thanks! Quote Share this post Link to post Share on other sites
+5-11under #2 Posted November 13, 2014 (edited) No, that won't work, because the "if" statement is looking for equality between both sides of the equal sign, in this case "score" and "score+20". You could try something like: level=score/20 if level=1 then goto level2 First of all, I'm not familiar with batari basic specifically, so I don't know if that syntax is correct. I'm using "/" as division. Second of all, I'm assuming the variable "score" is an integer, so that 19 divided by 20 is zero, but 20 divided by 20 is one. Edited November 13, 2014 by 5-11under 1 Quote Share this post Link to post Share on other sites
TheCoffeeFox #3 Posted November 13, 2014 Thank You I Will Try It Later Quote Share this post Link to post Share on other sites
Cybearg #4 Posted November 13, 2014 (edited) Second of all, I'm assuming the variable "score" is an integer, so that 19 divided by 20 is zero, but 20 divided by 20 is one. It's not, so this probably won't work as expected. In batariBasic, score is actually 3 BCD bytes, which means that the bytes go from $00 to $99 and each of those hex nybbles is read like the decimal digits 0-9. However, if you tried to divide them, you wouldn't get the same result: 99 / 2 = 49.5 $99 / 2 = 76.5 Edited November 13, 2014 by Cybearg 1 Quote Share this post Link to post Share on other sites
+Gemintronic #5 Posted November 13, 2014 Yeah. I'd avoid using score for anything but displaying the score. It gets complicated and fussy real fast. Instead, I'd, say, use a variable to count how many monsters you've killed to determine when to go level 2. _rem /** Determine if the players laser has hit a monster and chalk up another monster kill **/ _if collision(missile0, player1) then monsterskilled = monsterskilled + 1 _rem /** If the player has killed 20 monsters start the routine for level 2 **/ _if monsterskilled = 20 then goto level2 1 Quote Share this post Link to post Share on other sites
TheCoffeeFox #6 Posted November 14, 2014 How do I set monsters to not give me errors putting monsterskilled just give me black screen how do I set the setting? Quote Share this post Link to post Share on other sites
Cybearg #7 Posted November 14, 2014 (edited) How do I set monsters to not give me errors putting monsterskilled just give me black screen how do I set the setting? In that example, monsterskilled is just an arbitrary name for a variable. You set variables like so: dim monsterskilled = a Typically, people define all their variables like that before any code. The "dim" just means that you're defining a name for some memory. a-z are the names of variables that have been made available to you in batariBasic. Think algebra. Just like you can write a + b = c, you could also write monsterskilled + tummiestickled = laughsgiven, or any other combination of words. It's just a name to represent the number in an abstract way. All you need to do is let the compiler know what those words (variables) refer to, which is what the "dim" statement is for. That's why you were getting a black screen: the compiler didn't know what "monsterskilled" meant. Edited November 14, 2014 by Cybearg Quote Share this post Link to post Share on other sites
TheCoffeeFox #8 Posted November 14, 2014 Im Sorry Im Having trouble where do I put level2 playfield before titlescreen or after it and before level1 or after level 1? Quote Share this post Link to post Share on other sites
Cybearg #9 Posted November 14, 2014 Im Sorry Im Having trouble where do I put level2 playfield before titlescreen or after it and before level1 or after level 1? Typically, titlescreen logic is separate from level logic, so while it doesn't actually matter, most likely people will go titlescreen->level 1->level 2, etc. for the sake of semantics. If you haven't already, I'd recommend reading through RandomTerrain's excellent batariBasic documentation and checking out the examples. Quote Share this post Link to post Share on other sites