Jump to content
IGNORED

Player1 Movement


Jmche108
 Share

Recommended Posts

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

Link to comment
Share on other sites

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.

  • Like 1
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...