Jump to content
IGNORED

numbers...


ChilePepper

Recommended Posts

here is an example:

 

You know the tinkernut tutorial, right? That has you making a game in which a squirrel-thing chases a nut thing. to make the squirrel move you would use some lines of code like 

 

if player1y > player01 then player1y = player1y -1

 

how would I make it so that it would be like "then player1y = player1y - 0.5" aka, slowing down the squirrel. Help is appreciated. Thanks.

Link to comment
Share on other sites

Definitely check the link provided as it is a big help. Basically you have to define a special variable, so do something like :

 

dim squirrelthing_move = a.b

 

Then you define a and b.

 

So a=0 and b=5

 

So you can do this:

 

if player1y > player01 then player1y = player1y -squirrelthing_move

 

But if you are really interested in learning, I highly recommend reading the forums and Random Terrain's website. There is a lot of helpful information out there!

Link to comment
Share on other sites

uh oh, now its not moving period.

 

 a = 0
 b = 5
 dim slowspeed = a.b

 if player1y < player0y then player1y = player1y + slowspeed
 if player1y > player0y then player1y = player1y - slowspeed
 if player1x < player0x then player1x = player1x + slowspeed
 if player1x > player0x then player1x = player1x - slowspeed

 

once again, thanks for the help

Edited by ChilePepper
Link to comment
Share on other sites

50 minutes ago, KevKelley said:

Definitely check the link provided as it is a big help. Basically you have to define a special variable, so do something like :

 

dim squirrelthing_move = a.b

 

Then you define a and b.

 

So a=0 and b=5

 

So you can do this:

 

if player1y > player01 then player1y = player1y -squirrelthing_move

 

But if you are really interested in learning, I highly recommend reading the forums and Random Terrain's website. There is a lot of helpful information out there!

This would not work, it would only add a to player1y, and in this case it's 0 so nothing would happen,

and I don't think 0.5 sets b to five, probaly 128 or something.

  • Like 2
Link to comment
Share on other sites

7 hours ago, ChilePepper said:

Okay, so bogax's thing worked, except the speed of the squirrel seemed to change randomly, sometimes going painfully slow, sometimes turbo speed. How would I fix this? thanks for the 4th time.

Using this method you will need to add a statement for when player1 is less then player0, add this aswell

if player1y < player0y then p1y = p1y + 0.5

Im assuming what you're experiencing is when your player is above player1 it goes full speed

 

As for the speed being too slow - you will need to tweak the value as desired

  • Like 1
Link to comment
Share on other sites

this is what i got: 

 

 dim p1y = player1y.p
 dim p1x = player1x.p

 if player1y < player0y then p1y = p1y + 0.5
 if player1y > player0y then p1y = p1y - 0.5
 if player1x < player0x then p1x = p1x + 0.5
 if player1x > player0x then p1x = p1x - 0.5

 

still moving slow and fast and stufff. Thanks.

Edited by ChilePepper
Link to comment
Share on other sites

You are reusing the same variable. Try something like this instead:

 

   dim p1y = player1y.p
   dim p1x = player1x.o

 

Here's an example on the bB page:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#fixedpoint_p0_p1

 

There's also an example program:

 

randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_fixed_point_sprite

  • Like 2
  • Thanks 1
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...
  • Recently Browsing   0 members

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