Jump to content
Sign in to follow this  
Rabbit 2600

SMILEBASIC

Recommended Posts

Not sure if this is the right place, but I recently got my hands on Petite Computer for the 3DS an emulator for SMILEBASIC where you get to make your own software. I dabbled with BatariBasic so I figured somethings out but I need to ask a few questions to grasp somethings.

 

Anyway, my code so far allows for movement of an @ which is the player and an Z which would be a zombie.

 

My first question would be. How would I go about giving the zombie a random chance of moving towards the player if one of the buttons are pushed? I know how to make it move towards the player every time the buttons are pushed, I would need a random counter and I'm not sure on how to set them up. Like giving it a chance of 1 in 4.

X=5:Y=12

ZX=20:ZY=12

@LOOP

K=BUTTON(2)
IF K AND 1 THEN Y=Y-1
IF K AND 2 THEN Y=Y+1
IF K AND 4 THEN X=X-1
IF K AND 8 THEN X=X+1

LOCATE X,Y
?"@"

LOCATE ZX,ZY
?"Z"

VSYNC 1:CLS
GOTO @LOOP

Many thanks in advance =)

Share this post


Link to post
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.

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...