KevKelley Posted November 22, 2021 Share Posted November 22, 2021 I was curious. With on...goto statements, do they only work in instances where a variable is defined in steps, like x=x+1 or would it work with rand so when x equals a number it would go to that particular one? I haven't tried it out yet but when I get a chance I eabt s to see if it would work. Quote Link to comment https://forums.atariage.com/topic/327472-on-goto-and-rand/ Share on other sites More sharing options...
+Random Terrain Posted November 22, 2021 Share Posted November 22, 2021 on _Walk_Up goto __P0U0 __P0U1 __P0U2 __P0U3 The variable alias _Walk_Up used in the example above can safely have a value from 0 to 3 and that value can be in any order. The value of _Walk_Up could be 3, then 0, then 1, then 0 again. The value doesn't have to be from 0 to 3 in order, but you'll probably end up increasing the value by 1 when using on…goto for displaying sprite animation frames. 1 Quote Link to comment https://forums.atariage.com/topic/327472-on-goto-and-rand/#findComment-4952330 Share on other sites More sharing options...
KevKelley Posted November 22, 2021 Author Share Posted November 22, 2021 3 hours ago, Random Terrain said: on _Walk_Up goto __P0U0 __P0U1 __P0U2 __P0U3 The variable alias _Walk_Up used in the example above can safely have a value from 0 to 3 and that value can be in any order. The value of _Walk_Up could be 3, then 0, then 1, then 0 again. The value doesn't have to be from 0 to 3 in order, but you'll probably end up increasing the value by 1 when using on…goto for displaying sprite animation frames. Thanks. I was a little confused when reading. I had a "power up" code I was working on and was looking at various options. I had done something like "if x <> 1 then goto NOT_1" and then had a series of those but I didn't know if I chose a number at random how it would work. Quote Link to comment https://forums.atariage.com/topic/327472-on-goto-and-rand/#findComment-4952506 Share on other sites More sharing options...
+Gemintronic Posted November 28, 2021 Share Posted November 28, 2021 This isn't directly related to your question but take note of R.T.s Too Many Labels section. When I make Adventure-like games loading new screens uses long on .. goto statements. It's easy to think there's other problems when you've actually just reached the limit of labels on a single on .. goto statement. 1 Quote Link to comment https://forums.atariage.com/topic/327472-on-goto-and-rand/#findComment-4956034 Share on other sites More sharing options...
KevKelley Posted November 28, 2021 Author Share Posted November 28, 2021 2 hours ago, Gemintronic said: This isn't directly related to your question but take note of R.T.s Too Many Labels section. When I make Adventure-like games loading new screens uses long on .. goto statements. It's easy to think there's other problems when you've actually just reached the limit of labels on a single on .. goto statement. I had made similar mistakes or forgotten things, like how many ANDs or ORs you can have in a statement so while my brain thinks it was a genius making some crafty code reality slapped my face and told me to redo! In regards to my original question, when I tried the code in a couple different ways they all worked well. I can't remember now what I went with (I think it was my initial attempt) but it was nice to experiment with different methods or things. This will definitely be helpful in the future. 1 Quote Link to comment https://forums.atariage.com/topic/327472-on-goto-and-rand/#findComment-4956071 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.