You can do something like
Code: Select all
If EnemyX<YourX+8 or YourX-8<EnemyX
EnemyX - (EnemyX>YourX) + (EnemyX<YourX) ->EnemyX
Moderator: MaxCoderz Staff
Code: Select all
If EnemyX<YourX+8 or YourX-8<EnemyX
EnemyX - (EnemyX>YourX) + (EnemyX<YourX) ->EnemyX
Does the bounds have any effect in rouge, like not the off screen, but in the game?threefingeredguy wrote:Hahaha, it's a good thing to have vocabulary, it means you know a lot of words. I think you speak english well.
You can do something likeand do the same for Y values.Code: Select all
If EnemyX<YourX+8 or YourX-8<EnemyX EnemyX - (EnemyX>YourX) + (EnemyX<YourX) ->EnemyX
Code: Select all
If sub(Str0,(16(Y-1))+X,1)="H
Code: Select all
AxesOff:ClrDraw:ClrHome:2->H:2->Y
Output(1,1," Rogue v0.1
Output(3,4,"Loading
Output(4,1,"Generating area
69!:Output(3,11,".
1:prgmROGUEGEN //Map generator program
Output(4,1,"Generating char- //Loaded with funciton "1"
Output(5,1,"acter data
69!:Output(3,12,".
1:prgmROGUECHA //Character generation program
Output(4,1,"Working out mon- //Loaded with function "1"
Output(5,13'".
1:prgmROGUEMON //Monster Generation program
Output(4,1,"Done, press //Loaded with function "1"
Output(5,1,"ENTER to begin
Pause
ClrHome
Repeat 0 //Engine start HERE
Output(1,1,Str0 //The map is stored in Str0
Output(L2(2),L2(1),"k //Display the kobold (monster)
Ouput(Y,X,"@ //Display yourself "@"
Repeat Ans
getkey->K
End
X->A:Y->B
X+(K=26)-(K=24->X
Y+(K=34)-(K=25->Y
X-(X>16)+(X<1->X
Y-(Y>8)-(Y<1->Y
Output(1,1,Str0
If sub(Str0,(16(y-1))+X,1)="H
Then
A->X
B->Y
Output(8,1,"You bumped into
Pause
Output(8,1,"a wall
End
if K=55 and sub(Str0,(16(Y-1))+X,1)="> //This is the stairs :p
Then
L+1->L
L:prgmROGUEGEN //Map generation program
End //with function "L" (level var)
If K=55 and sub(Str0,(16(Y-1))+X,1)="< //This is the stairs :p
Then
L-1->L
L`:prgmROGUEGEN
End
If L>2 //This is only an alpha
Then //don't expect 30 levels :p
ClrHomt
Output(4,7,"Woot!
End
If L<1:Then
ClrHome
Disp "Loser!! you ascended!!!
Pause:ClrHome
Stop
End
2:prgmROGUEMON //AI is loaded HERE after you chose what you will
End //do
Code: Select all
If Ans=1:Then
If L=1:{8,6,8,6,3,20,10,2,5,0,0,0,1}->L2 //{8,6,8,6} is the equi-
Return:End //valence of X,Y,A,B in prgmROGUE
If Ans=2:Then
L2(2)-Y->T //L2(2) is in fact the equivalent of the Y
L2(1)-X->U //Same here but for X
If T>1:L2(2)-1->L2(2)
If T<-1:L2(2)+1->L2(2)
If U>1:L2(1)-1->:L2(1)
If U<-1L2(1)+1->L2(1)
If sub(Str0,(16(L2(2)-1))+L2(1),1)!="H
Then
L2(3)->L2(1)
L2(4)->L2(2)
End
L2(1)->L2(3)
L2(2)->L2(4)
Return:End