Данная проверка поможет Вам понять смысл как нужно просчитывать движение героя по клеточкам чтобы тот ходил лишь по проходимым участкам с нужной скоростью
//prorisovka geroya esli on dvizhetsya if Player.Go=true then begin //otstentrovka karti na geroye Karta.mx:=Player.x-round(vidX/2)*60; karta.my:=Player.y-round(vidy/2)*60;
//vverh udet if qup=true then begin if ((Karta.prohodimost[round(Player.lv.x div 60),round((Player.lv.y-Player.speed) div 60)]=true) and (Karta.prohodimost[round(Player.pv.x div 60),round((Player.pv.y-Player.speed) div 60)]=true)) or ((Karta.map[round(Player.lv.x div 60),round((Player.lv.y-Player.speed) div 60)]=1) and (Karta.map[round(Player.pv.x div 60),round((Player.pv.y-Player.speed) div 60)]<>1)) or ((Karta.map[round(Player.lv.x div 60),round((Player.lv.y-Player.speed) div 60)]<>1) and (Karta.map[round(Player.pv.x div 60),round((Player.pv.y-Player.speed) div 60)]=1)) then begin if Karta.map[round(player.x/60),round((Player.y-Player.speed)/60)]=2 then Player.grnBonus:=2 else Player.grnBonus:=0;
if qGoSpeed=false then begin Player.y:=Player.y-5-Player.GrnBonus; Karta.my:=Karta.my-5-Player.GrnBonus; end;
if qGoSpeed=true then begin Player.y:=Player.y-Player.speed-Player.GrnBonus; Karta.my:=Karta.my-Player.speed-Player.GrnBonus; Player.vinoslivost:=Player.vinoslivost-1; end;
Player.Plavaet:=false; end; end; //vverh plivet if qup=true then begin if (Karta.map[round(Player.lv.x div 60),round((Player.lv.y-Player.speed) div 60)]=1) and (Karta.map[round(Player.pv.x div 60),round((Player.pv.y-Player.speed) div 60)]=1) and (Player.Plavaniye>0) and (Karta.objects[round(Player.lv.x div 60),round((Player.lv.y-Player.speed) div 60)]=0) and (Karta.objects[round(Player.pv.x div 60),round((Player.pv.y-Player.speed) div 60)]=0) then begin Player.y:=Player.y-Player.Plavaniye; Karta.my:=Karta.my-Player.Plavaniye; Player.Plavaet:=true; end; end;
//vniz idet if qDown=true then begin if ((Karta.prohodimost[round(Player.ln.x div 60),round((Player.ln.y+Player.speed) div 60)]=true) and (Karta.prohodimost[round(Player.pn.x div 60),round((Player.pn.y+Player.speed) div 60)]=true)) or ((Karta.map[round(Player.ln.x div 60),round((Player.ln.y+Player.speed) div 60)]=1) and (Karta.map[round(Player.pn.x div 60),round((Player.pn.y+Player.speed) div 60)]<>1)) or ((Karta.map[round(Player.ln.x div 60),round((Player.ln.y+Player.speed) div 60)]<>1) and (Karta.map[round(Player.pn.x div 60),round((Player.pn.y+Player.speed) div 60)]=1)) then begin if Karta.map[round(player.x/60),round((Player.y+Player.speed)/60)]=2 then Player.grnBonus:=2 else Player.grnBonus:=0;
if qGoSpeed=false then begin Player.y:=Player.y+5+Player.GrnBonus; Karta.my:=Karta.my+5+Player.GrnBonus; end;
if qGoSpeed=true then begin Player.y:=Player.y+Player.speed+Player.GrnBonus; Karta.my:=Karta.my+Player.speed+Player.GrnBonus; Player.vinoslivost:=Player.vinoslivost-1; end; Player.Plavaet:=false; end; end; //vniz plivet if qDown=true then begin if (Karta.map[round(Player.ln.x div 60),round((Player.ln.y+Player.speed) div 60)]=1) and (Karta.map[round(Player.pn.x div 60),round((Player.pn.y+Player.speed) div 60)]=1) and (Player.Plavaniye>0) and (Karta.objects[round(Player.ln.x div 60),round((Player.ln.y+Player.speed) div 60)]=0) and (Karta.objects[round(Player.pn.x div 60),round((Player.pn.y+Player.speed) div 60)]=0) then begin Player.y:=Player.y+Player.Plavaniye; Karta.my:=Karta.my+Player.Plavaniye; Player.Plavaet:=true; end; end;
//vlevo idet if qLeft=true then begin if ((Karta.prohodimost[round((Player.lv.x-Player.speed) div 60),round(Player.lv.y div 60)]=true) and (Karta.prohodimost[round((Player.ln.x-Player.speed) div 60),round(Player.ln.y div 60)]=true)) or ((Karta.map[round((Player.lv.x-Player.speed) div 60),round(Player.lv.y div 60)]=1) and (Karta.map[round((Player.ln.x-Player.speed) div 60),round(Player.ln.y div 60)]<>1)) or ((Karta.map[round((Player.lv.x-Player.speed) div 60),round(Player.lv.y div 60)]<>1) and (Karta.map[round((Player.ln.x-Player.speed) div 60),round(Player.ln.y div 60)]=1)) then begin if Karta.map[round((player.x-Player.speed)/60),round(Player.y/60)]=2 then Player.grnBonus:=2 else Player.grnBonus:=0;
if qGoSpeed=false then begin Player.x:=Player.x-5-Player.GrnBonus; Karta.mx:=Karta.mx-5-Player.GrnBonus; end;
if qGoSpeed=true then begin Player.x:=Player.x-Player.speed-Player.GrnBonus; Karta.mx:=Karta.mx-Player.speed-Player.GrnBonus; Player.vinoslivost:=Player.vinoslivost-1; end;
Player.Plavaet:=false; end; end; //vlevo plivet if qLeft=true then begin if (Karta.map[round((Player.lv.x-Player.speed) div 60),round(Player.lv.y div 60)]=1) and (Karta.map[round((Player.ln.x-Player.speed) div 60),round(Player.ln.y div 60)]=1) and (Player.Plavaniye>0) and (Karta.objects[round((Player.lv.x-Player.speed) div 60),round(Player.lv.y div 60)]=0) and (Karta.objects[round((Player.ln.x-Player.speed) div 60),round(Player.ln.y div 60)]=0) then begin Player.x:=Player.x-Player.Plavaniye; Karta.mx:=Karta.mx-Player.Plavaniye; Player.Plavaet:=true; end; end;
//vpravo idet if qRight=true then begin if ((Karta.prohodimost[round((Player.pv.x+Player.speed) div 60),round(Player.pv.y div 60)]=true) and (Karta.prohodimost[round((Player.pn.x+Player.speed) div 60),round(Player.pn.y div 60)]=true)) or ((Karta.map[round((Player.pv.x+Player.speed) div 60),round(Player.pv.y div 60)]=1) and (Karta.map[round((Player.pn.x+Player.speed) div 60),round(Player.pn.y div 60)]<>1)) or ((Karta.map[round((Player.pv.x+Player.speed) div 60),round(Player.pv.y div 60)]<>1) and (Karta.map[round((Player.pn.x+Player.speed) div 60),round(Player.pn.y div 60)]=1)) then begin if Karta.map[round((player.x+Player.speed)/60),round(Player.y/60)]=2 then Player.grnBonus:=2 else Player.grnBonus:=0;
if qGoSpeed=false then begin Player.x:=Player.x+5+Player.GrnBonus; Karta.mx:=Karta.mx+5+Player.GrnBonus; end;
if qGoSpeed=true then begin Player.x:=Player.x+Player.speed+Player.GrnBonus; Karta.mx:=Karta.mx+Player.speed+Player.GrnBonus; Player.vinoslivost:=Player.vinoslivost-1; end;
Player.Plavaet:=false; end; end;
//vpravo plivet if qRight=true then begin if (Karta.map[round((Player.pv.x+Player.speed) div 60),round(Player.pv.y div 60)]=1) and (Karta.map[round((Player.pn.x+Player.speed) div 60),round(Player.pn.y div 60)]=1) and (Karta.objects[round((Player.pv.x+Player.speed) div 60),round(Player.pv.y div 60)]=0) and (Karta.objects[round((Player.pn.x+Player.speed) div 60),round(Player.pn.y div 60)]=0) and (Player.Plavaniye>0) then begin Player.x:=Player.x+Player.Plavaniye; Karta.mx:=Karta.mx+Player.Plavaniye; Player.Plavaet:=true; end; end;