thisotherguy:
I have been working on it and I am getting erratic results so far. I will need to spend some time on it to figure it out. It might be better to check collision versus each robot individually instead of checking against everything. It makes sense to me to do the check after the sprite is placed. I also am wondering if we will need to use the SPRITE command instead of the paste sprite we have been using.
Quote: "But anyways, I also asked where in the difficultymenu function the function of clicking on a button is so I can put the difficulty there."
I take it you are referring to placing something on the menu to show which one the user has currently selected. You could make a quick triangle in Gimp or MS Paint and place it beside the button that represents the difficulty. You start off with difficulty = 2, right? Since we are using buttons 7 - 10, this would correspond with button 8. You take the coordinates for button 8, subtract from the x coordinate the x size of your triangle and paste it on the screen after everything else has been displayed. If the user clicks on a different difficulty, you calculate the position the same way.
Quote: "EDIT: Actually, after a bit of logical thinking lol. I assume do an until difficulty=1 or difficulty=2 ect.
Then put it in the main loop. Right?"
After the user has clicked to return to the main menu, you set the difficulty. This would go after the user has let go of the LMB.
Quote: "EDIT TWO: I forgot, but did you read my bug post a couple back on page 5? There was no way to the door. It needs to be fixed."
I wasn't aware that you had posted that. Taking screenshots is easy. On the upper right side of the keyboard you have a key that says 'PrtScn'. Get the game where you want and press this button. Exit the game and open up MS Paint. Click the paste button and save it as a .jpg. Then post it up here (for the future).
That shows an error from the original rooms and should have been fixed when I revised them. Are you using the most current version of the code? I have not seen this issue since I revised the rooms. If you are still experiencing this, please post up a pic.
EDIT:
thisotherguy, this seems to be working pretty well, but I have not thoroughly tested it.
function MoveRobots()
for i= 1 to maze(player.room).robotsleft
if robot(i).destroyed = 0
if robot(i).turn<50
inc robot(i).turn
else
robot(i).turn=0
robot(i).axis = 1 + rnd(2)
endif
if robot(i).axis=1
if player.x<robot(i).x then clear(i) : robot(i).robl=1
if player.x=robot(i).x then robot(i).robl=0 : robot(i).robr=0
if player.x>robot(i).x then clear(i) : robot(i).robr=1
endif
if robot(i).axis=2
if player.y<robot(i).y then clear(i) : robot(i).robu=1
if player.y=robot(i).y then robot(i).robu=0 : robot(i).robd=0
if player.y>robot(i).y then clear(i) : robot(i).robd=1
endif
if robot(i).axis =3
clear(i)
robot(i).scannerbearing=acos((player.x-robot(i).x)/sqrt(((player.x-robot(i).x)*(player.x-robot(i).x))+((player.y-robot(i).y)*(player.y-robot(i).y))))
if player.y>robot(i).y then robot(i).scannerbearing = 360 - robot(i).scannerbearing
look=int(wrapvalue(robot(i).scannerbearing)/15)+1
angleframe=52+look
if look>12 then inc angleframe
set sprite frame robot(i).SprNum, angleframe
`text robot(i).x-5, robot(i).y+30, STR$(robot(i).scannerbearing)+" "+STR$(look)
endif
if robot(i).robu
robot(i).aim = 1
bx = int((robot(i).x + 16) / 32) : by = int((robot(i).y + 16) / 32)
coo = coord(player.room,bx ,by )
coo2 = coord(player.room,bx + 1,by)
if coo = 0 and coo2 = 0
dec robot(i).y,1
frame = sprite frame(robot(i).SprNum)
lftc = 14 : uftc = 26 : // frames to check to see if the user has changed directions
if frame < lftc or frame > uftc
set sprite frame robot(i).SprNum,lftc : // user changed directions - set it to the start frame
endif
play sprite robot(i).SprNum,14,26,50
else
play sprite robot(i).SprNum,85,90,100
set sprite frame robot(i).SprNum,85
robot(i).destroyed = 1 : robot(i).Edelay = timer() + 100
endif
endif
if robot(i).robl
robot(i).aim = 4
bx = int((robot(i).x + 20) / 32) : by = int((robot(i).y + 16) / 32)
coo = coord(player.room,bx ,by )
coo2 = coord(player.room,bx,by + 1)
if coo = 0 and coo2 = 0
dec robot(i).x,1
frame = sprite frame(robot(i).SprNum)
lftc = 27 : uftc = 39 : // frames to check to see if the user has changed directions
if frame < lftc or frame > uftc
set sprite frame robot(i).SprNum,lftc : // user changed directions - set it to the start frame
endif
play sprite robot(i).SprNum,27,39,50
else
play sprite robot(i).SprNum,98,103,100
set sprite frame robot(i).SprNum,98
robot(i).destroyed = 2 : robot(i).Edelay = timer() + 100
endif
endif
if robot(i).robd
robot(i).aim = 3
bx = int((robot(i).x + 16) / 32) : by = int((robot(i).y + 56) / 32)
coo = coord(player.room,bx ,by )
coo2 = coord(player.room,bx + 1,by)
if coo = 0 and coo2 = 0
inc robot(i).y,1
frame = sprite frame(robot(i).SprNum)
lftc = 40 : uftc = 52 : // frames to check to see if the user has changed directions
if frame < lftc or frame > uftc
set sprite frame robot(i).SprNum,lftc : // user changed directions - set it to the start frame
endif
play sprite robot(i).SprNum,40,52,50
else
play sprite robot(i).SprNum,79,84,100
set sprite frame robot(i).SprNum,79
robot(i).destroyed = 3 : robot(i).Edelay = timer() + 100
endif
endif
if robot(i).robr
robot(i).aim = 2
bx = int((robot(i).x + 40) / 32) : by = int((robot(i).y + 16) / 32)
coo = coord(player.room,bx ,by )
coo2 = coord(player.room,bx,by + 1)
if coo = 0 and coo2 = 0
inc robot(i).x,1
frame = sprite frame(robot(i).SprNum)
lftc = 1 : uftc = 13 : // frames to check to see if the user has changed directions
if frame < lftc or frame > uftc
set sprite frame robot(i).SprNum,lftc : // user changed directions - set it to the start frame
endif
play sprite robot(i).SprNum,1,13,50
else
play sprite robot(i).SprNum,92,97,100
set sprite frame robot(i).SprNum,92
robot(i).destroyed = 4 : robot(i).Edelay = timer() + 100
endif
endif
sprite robot(i).SprNum,robot(i).x,robot(i).y,sprite image(robot(i).SprNum)
show sprite robot(i).SprNum
if robot(i).destroyed = 0
for n = 1 to maze(player.room).robotsleft
if n <> i and robot(n).destroyed = 0
if sprite collision(robot(i).SprNum,robot(n).SprNum)
set sprite frame robot(i).SprNum,85
play sprite robot(i).SprNum,85,90,100
robot(i).destroyed = 1 : robot(i).Edelay = timer() + 100
set sprite frame robot(n).SprNum,85
play sprite robot(n).SprNum,85,90,100
robot(n).destroyed = 1 : robot(n).Edelay = timer() + 100
endif
endif
next n
endif
else
frame = sprite frame(robot(i).SprNum)
select robot(i).destroyed
case 1
if frame = 90
robot(i).destroyed = 5 : `dec maze(player.room).robotsleft
hide sprite robot(i).SprNum
else
play sprite robot(i).SprNum,85,90,100
paste sprite robot(i).SprNum,robot(i).x,robot(i).y
endif
endcase
case 2
if frame = 103
robot(i).destroyed = 5 : `dec maze(player.room).robotsleft
hide sprite robot(i).SprNum
else
play sprite robot(i).SprNum,98,103,100
paste sprite robot(i).SprNum,robot(i).x,robot(i).y
endif
endcase
case 3
if frame = 84
robot(i).destroyed = 5 : `dec maze(player.room).robotsleft
hide sprite robot(i).SprNum
else
play sprite robot(i).SprNum,frame,84,100
paste sprite robot(i).SprNum,robot(i).x,robot(i).y
endif
endcase
case 4
if frame = 97
robot(i).destroyed = 5 : `dec maze(player.room).robotsleft
hide sprite robot(i).SprNum
else
play sprite robot(i).SprNum,frame,97,100
paste sprite robot(i).SprNum,robot(i).x,robot(i).y
endif
endcase
endselect
endif
next i
endfunction
Post EDIT:
I am working on making the maze interior walls look better. Here is a pic of room #1.