Main Menu

Help

Started by piggood, June 07, 2019, 08:01:37 AM

Previous topic - Next topic

piggood

I'm trying to make a creeper laser that stops at anticreeper, but it doesn't work.
$Delay:500
$intDelay:0
$amt:30
0 ->f
once
<-intDelay Delay
endonce
<-hi 1 lt if
RandXCoord ->x
<-x CurrentY 5 QueueMove
1 ->hi
endif
<-Delay Delay
CurrentX <-x eq if
MapHeight 0 do
<-not 1 neq if
<-f CurrentX GetCreeper ->the
<-the 0 lt if
1 ->not
endif
CurrentX <-f <-amt SetCreeper
<-f 1 add ->f
endif
loop
0 ->f
0 ->hi
0 ->not
endif

cornucanis

What behavior are you seeing from it exactly? It's difficult to say what the issue is without knowing the current behavior, but the main thing I notice is that you mixed up your X and Y coordinates for the GetCreeper call at

Quote<-f CurrentX GetCreeper ->the

Speaking of which, it may be easier for you to catch these sort of oversights if you use more descriptive variable names such as ->thisY or ->creeperLevel. Also, it seems like you can probably remove the "f" variable altogether. You're basically using it in the exact manner the index variable I operates within loops. See here for more info about  using index variables.