Rabbit 2600 Posted April 26, 2014 Share Posted April 26, 2014 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 =) 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.