Jmche108 Posted September 6, 2016 Share Posted September 6, 2016 Hello, I am a complete noob to Batari basic. So far I have made a spinoff of a tutorial I have watched on YouTube. I would like to change the player1 sprite movement but I don't know how. I would like for player1 sprite to move vertically down the screen to where if you let the sprite pass you and exit the screen, you lose a life. Right now the sprite will move to your location. Sorry for my lack of knowledge. Thanks You can look at the .bas file to see what I'm talking about. Tie Fighter.bas Quote Link to comment Share on other sites More sharing options...
Mountain King Posted September 6, 2016 Share Posted September 6, 2016 Hello, welcome to the forum. You followed the tinkernut tutorial, which I personally don't like. It tells you what to type but doesn't really explain what you are doing. As for your code, I don't want to completely give you the answer. You learn better if you can figure it out on your own. I will say look at this part of the code. rem Have player 1 chase player 2 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 player1x = player1x : player1y = player1y This really controls what the Tie fighter does. If you change these lines and add a line or two, you can get the tie fighter to behave the way you want to. You should also check out Random Terrain's site. There is tons of information there that will help you. As well as some code snippets. I learned more from that site than from the Tinkernut tutorial. 1 Quote Link to comment Share on other sites More sharing options...
ultima Posted September 6, 2016 Share Posted September 6, 2016 sort of like this?tiefighter.bas love star wars 1 Quote Link to comment Share on other sites More sharing options...
Jmche108 Posted September 7, 2016 Author Share Posted September 7, 2016 sort of like this?tiefighter.bas love star wars Yes! Thanks, that is what I was looking for. Quote Link to comment Share on other sites More sharing options...
Jmche108 Posted September 7, 2016 Author Share Posted September 7, 2016 Ok, I have a basic idea of what the code means. IF player1y >= _BottomOfScreen then score=score-1:a=a-1:player1y = 0:player1x=(rand&127) + 22 : goto deadsound If player1 goes to the bottom of the screen then -1 score. player1 on the y axis is equal to 0, player 1 on the x axis is equal to random. What I don't understand is the last part "=(rand&127) + 22". How do I make it where player1 spawns anywhere between point a and point b on the x axis. I don't want player 1 to spawn at the very edge of the screen. Thanks Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 7, 2016 Share Posted September 7, 2016 Look at the "Did You Know?" box here: randomterrain.com/atari-2600-memories-batari-basic-commands.html#rand Quote Link to comment Share on other sites More sharing options...
Jmche108 Posted September 7, 2016 Author Share Posted September 7, 2016 Look at the "Did You Know?" box here: randomterrain.com/atari-2600-memories-batari-basic-commands.html#rand Yeah I looked at it but I'm still not sure how to go about my problem. I need player1 to spawn randomly on the x axis but within a range. The code I have now makes player1 spawn out of the playfield. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 7, 2016 Share Posted September 7, 2016 Yeah I looked at it but I'm still not sure how to go about my problem. I need player1 to spawn randomly on the x axis but within a range. The code I have now makes player1 spawn out of the playfield. If you know that (rand&127) gives you a range between 0 and 127 and you need less than that, the "Did You Know?" box has the answer. It's also helpful to use this program to find the exact range you are looking for: randomterrain.com/atari-2600-memories-batari-basic-commands.html#find_border_coordinates Quote Link to comment Share on other sites More sharing options...
Jmche108 Posted September 7, 2016 Author Share Posted September 7, 2016 If you know that (rand&127) gives you a range between 0 and 127 and you need less than that, the "Did You Know?" box has the answer. It's also helpful to use this program to find the exact range you are looking for: randomterrain.com/atari-2600-memories-batari-basic-commands.html#find_border_coordinates I didn't see the program. Problem fixed, Thanks 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.