Hey all, I been working on a RPG game in AMS started off well but seems i hit a wall
and that wall is when i am touch one wall i am able to walk thought another wall
or object that is not meant to be able to wake thought.
The code used to stop the player walking thought the objects.:
and called on key
but i did a few tests and it sees if i am touching a object and walk up to another
i walk thought the other one.
and that wall is when i am touch one wall i am able to walk thought another wall
or object that is not meant to be able to wake thought.
The code used to stop the player walking thought the objects.:
Code:
function CheckBoarders(ImageName) LeftPremission = true; RightPremission = true; UpPremission = true; DownPremission = true; local Objects = Page.EnumerateObjects(); for i,j in Objects do if ImageName ~= j and j ~= "Report" and j ~= "%Actors_Title%" and j ~= "%Actors_Text%" and j ~= "%Yes%" and j ~= "%No%" and j ~= "%Continue%" and j ~= "Sleep" then local DynamicObjectX = Image.GetPos(ImageName).X; local DynamicObjectY = Image.GetPos(ImageName).Y; if Math.Abs(Image.GetPos(j).X-(DynamicObjectX+32)) < Speed and Math.Abs(DynamicObjectY-Image.GetPos(j).Y) < 32 then RightPremission = false; return j; end if Math.Abs((Image.GetPos(j).X+32)-DynamicObjectX) < Speed and Math.Abs(DynamicObjectY-Image.GetPos(j).Y) < 32 then LeftPremission = false; return j; end if Math.Abs(Image.GetPos(j).Y-(DynamicObjectY+32))< Speed and Math.Abs(DynamicObjectX-Image.GetPos(j).X) < 32 then DownPremission = false; return j; end if Math.Abs((Image.GetPos(j).Y+32)-DynamicObjectY)< Speed and Math.Abs(DynamicObjectX-Image.GetPos(j).X) < 32 then UpPremission = false; return j; end end end end
Code:
Speed = 3; Motion = 60; ObjectName = CheckBoarders("PI_Main"); if MoveAction then if e_Key == 87 then MokPG.MoveUP(Speed, Motion); end if e_Key == 83 then MokPG.MoveDown(Speed, Motion); end if e_Key == 65 then MokPG.MoveLeft(Speed, Motion); end if e_Key == 68 then MokPG.MoveRight(Speed, Motion); end else if e_Key == 27 then MokPG.ExitAction(); end end
i walk thought the other one.
Comment