The RPG Demo - Help needed :P

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • sim
    No longer a forum member
    • Nov 2009
    • 1634

    The RPG Demo - Help needed :P

    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.:
    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
    and called on key

    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
    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.
  • Centauri Soldier
    Indigo Rose Customer
    • Jun 2007
    • 1703

    #2
    Do you mean "Permission"?

    Would it be easier, instead of using a boolean to check the contact of player to an object or wall, simply check if the player is at or past a specific x,y point and if so place him at the maximum position allowed based on which (x or y or both) axis his position violates.
    https://github.com/CentauriSoldier

    Comment

    • RizlaUK
      Indigo Rose Customer
      • May 2006
      • 5552

      #3
      collision checking is not easy even in environments that are aimed specificity at game development, its going to take a few k lines of code to get it to work properly

      you might want to look at using some kind of external lib :yes
      Embrace change in your life, you never know, it could all work out for the best

      Comment

      • sim
        No longer a forum member
        • Nov 2009
        • 1634

        #4
        Originally posted by Centauri Soldier
        Do you mean "Permission"?
        I don't know what you mean about this part?

        I am a noob when it comes to this kinda thing so i don't know what would be the best arb helped me on this part of the program and he was great but seems hes
        busy to help us with this code.

        I don't want to use dll's as i have no idea how to use them and it also kills the hope point in my idea lol.

        This RPG game only users AMS coding and plugins that only use AMS coding.


        @ Centauri Soldier could you make a little demo in what you mean? I was going to change the hole thing to a plugin when i have everything working so this is why
        the player looks for the actors and walls.

        Your replys are useful to people that understand more then a fish in a bucket but i am dumb lol, some might say why try it then well if i don't who will and i do plan
        to give back to forum when done.

        Comment

        • RizlaUK
          Indigo Rose Customer
          • May 2006
          • 5552

          #5
          try searching the old AMS 6 examples forum, one of the IR team posted a bouncing ball example in there ages ago, im sure it will contain some code you can use
          Embrace change in your life, you never know, it could all work out for the best

          Comment

          • Imagine Programming
            Indigo Rose Customer
            • Apr 2007
            • 4252

            #6
            Originally posted by sim View Post
            I don't know what you mean about this part?
            He means that Permission is spelled like Permission, in your script you have
            spelled it 'Premission'.
            Bas Groothedde
            Imagine Programming :: Blog

            AMS8 Plugins
            IMXLH Compiler

            Comment

            • sim
              No longer a forum member
              • Nov 2009
              • 1634

              #7
              Originally posted by Imagine Programming View Post
              He means that Permission is spelled like Permission, in your script you have
              spelled it 'Premission'.
              or that lol i left it cos arb did it like that and the problem the walls are not the app edgers its a image i will upload the apz later i am busy with a web project so it
              might be later tonigt you see his code works unless your already touching a nother image.

              Comment

              Working...
              X