lucid's Recent Forum Activity

  • sometimes when using the platform behavior it's difficult to implement features that would require the platformer to temporarily ignore certain types of obstacles. For instance, an elevator carrying a platformer through the next floor will stay on the next floor after the elevator moves past if the floor is a platform, or will hit the ceiling and fall if it's a solid. Stairways are much more difficult to implement for the same reasons, and the added trouble that they are always in the way on the bottom floor and impossible to get to through the top floor. Those are the first examples that come to mind, but there are other cases, mostly moving platform scenarios, but other things, like ladders, or ghosts that can phase through walls the character can't, but should still obey the ground.

    The following proposed additions are to alleviate this problem by allowing the behavior to temporarily ignore user-specified object types.

    the altered files are here:

    http://dl.dropbox.com/u/1013446/platform/Platform.rar

    and the changes are summarized below:

    changes:

    in MAIN:

    added one vector for objecttypes to ignore, and the function for checking the ignore list

    	vector<CRunObjType*> ignorelist;
    	bool IsIgnoring(CRunObjType* objtype);[/code:vtkaqhm8]
    
    ACETABLE:
    added three actions,  Add Object to ignore list, Remove Object from ignore list, and Clear ignore list
    [code:vtkaqhm8]	ADDPARAM(PARAM_OBJECT, "ObjectType to Ignore", "Ignore platforms and solids of this object type");
    	ADDACT("Add Object to ignore list", "Ignore", "Add %0 to ignore list", &ExtObject::aAddToIgnoreList, "AddToIgnoreList", 0);
    	ADDPARAM(PARAM_OBJECT, "ObjectType to Stop Ignoring", "Stop Ignoring platforms of this object type");
    	ADDACT("Remove Object from ignore list", "Ignore", "Remove %0 from ignore list", &ExtObject::aRemoveFromIgnoreList, "RemoveFromIgnoreList", 0);
    	ADDACT("Clear ignore list", "Ignore", "Clear ignore list", &ExtObject::aClearIgnoreList, "ClearIgnoreList", 0);[/code:vtkaqhm8]
    	
    ACTIONS:
    implement the three actions with simple vector commands, doublechecking to make sure the user doesn't add the same type twice
    [code:vtkaqhm8]	long ExtObject::aAddToIgnoreList(LPVAL theParams)
    	{
    		for(int i=0;i<ignorelist.size();i++)
    		{
    			if (ignorelist[i]==theParams->GetObjectParam(pRuntime))
    				return 0;
    		}
    		ignorelist.push_back(theParams->GetObjectParam(pRuntime));
    		return 0;
    	}
    	//ADDPARAM(PARAM_OBJECT, "Object to Stop Ignoring", "Stop Ignoring platforms of this object type");
    	//ADDACT("Remove Object from ignore list", "Ignore", "Remove %0 from ignore list", &ExtObject::aRemoveFromIgnoreList, "RemoveFromIgnoreList", 0);
    
    	long ExtObject::aRemoveFromIgnoreList(LPVAL theParams)
    	{
    		
    		for(int i=0;i<ignorelist.size();i++)
    		{
    			if (ignorelist[i]==theParams->GetObjectParam(pRuntime))
    			{
    				vector<CRunObjType*>::iterator it=ignorelist.begin()+i;
    				ignorelist.erase(it);
    			}
    		}
    		return 0;
    	}
    	//ADDACT("Clear ignore list", "Ignore", "Clear ignore list", &ExtObject::aClearIgnoreList, "ClearIgnoreList", 0);
    
    	long ExtObject::aClearIgnoreList(LPVAL theParams)
    	{
    		ignorelist.clear();
    		return 0;
    	}[/code:vtkaqhm8]
    
    RUNTIME:
    implementation of IsIgnoring
    [code:vtkaqhm8]	bool ExtObject::IsIgnoring(CRunObjType* objtype)
    	{
    		for (int j = 0; j < ignorelist.size(); j++) 
    		{
    			if (ignorelist[j]==objtype)
    			{
    				return true;
    			}
    		}
    		return false;
    	}[/code:vtkaqhm8]
    	
    Add IsIgnoring check to the beginning of OverlapTest
    [code:vtkaqhm8]	bool ExtObject::OverlapTest(CRunObject* pObj)
    	{
    		if(IsIgnoring(pObj->pType))
    			return false;
    		...
    		...
    		...
    	}[/code:vtkaqhm8]
    	
    Add two IsIgnoring checks to IsOverlapping, one for the platform check, and one for the Solid check, and change the check solids to manually checking one by one, so that each object can be checked against the ignore list
    	[code:vtkaqhm8]bool ExtObject::IsOverlapping( bool solids_only )
    	{
    		...
    		...
    		...
    		...
    					int count;
    					CRunObject **objs;
    					pRuntime->GetTypeSelectedInstances(pObstacles, objs, count);
    					for(int i = 0; i < count; i++) 
    					{
    
    						{
    							CRunObject* platform = objs[i]; // do here	
    							if (!IsIgnoring(platform->pType))
    							{
    								if(pRuntime->QueryCollision(pLink, platform))
    								{;
    								pLink->info.x = fx;
    								pLink->info.y = fy;
    								pRuntime->UpdateBoundingBox(pLink);
    								return true;
    								}
    							}
    
    						}
    					}
    	...
    	...
    	...
    	
    						if(platforms_inside.find(platform) ==  platforms_inside.end())
    						{
    							if(!IsIgnoring(platform->pType))
    							{
    								if(pRuntime->QueryCollision(pLink, platform))
    								{
    									pLink->info.x = fx;
    									pLink->info.y = fy;
    									pRuntime->UpdateBoundingBox(pLink);
    									return true;
    	...
    	...
    	...
    	
    	}
    [/code:vtkaqhm8]
  • um

    so, anyone know how to work that custom movement thing?

  • there is a command

    just type distance(somethingx,somethingy,somethingelsex,somethingelsey)

    and sorry

    at the end of that example I gave you

    previousx = sprite.x

    previousy=sprite.y

    previousx and previousy being private variables you made

    also,physics does have an expression for speed

    this won't do anything, but just to help you find the expressions, do something like

    sprite - set angle

    instead of typing in a new angle, double click a sprite with physics behavior, when it brings up the list of expressions, click on the physics tab, that's the list of physics expressions

    velocity x component and y component

  • to spawn sprites in specific locations with specific dimensions

    System : Create Object (let's you specify the location)

    Sprite.SetWidth

    Sprite.SetHeight

    actions after an object is created, and in the same event will apply to the object that was just created

    if you're using behaviors to move your sprites, most behaviors have an expression for speed,

    for instance, Set private variable MyCollisionSpeed to

    and then double click on the sprite, and click on the behaviors tab to find the expression for speed

    if you're using your own movement method, and no behavior, the way to determine speed is to set up two private variables, previousx, and previousy

    if you need absolute speed, or the specific x and y speed

    always

    set absspeed to distance(previousx,previousy,sprite.x,sprite.y)

    set xspeed to(sprite.x-previousx)

    set yspeed to (sprite.y-previousy)

  • rockin

  • if what you're asking is what I think you're asking, you may be looking for templates

    when you make an array of anything you can set a default for new array values

    templates are the defaults for super arrays

    in the example cap I didn't use a template because I wasn't sure if you knew about them

    but in this case you would say

    Action : Create Template

    template name "coord"

    add number array to {"t","coord"} "x" with default 0

    add number array to {"t","coord"} "y" with default 0

    the "t" as the first part of the address tells s you're adding to a special template super and not a regular super in your whole data structure

    you can use these as you can any other super, adding other supers inside if you wish, etc

    now when you create a super array you can do

    create super array "mycoords" with default "coord"

    now each time you add a super, it will already have the "x" and "y" arrays in it

    you can even fill the arrays with values in the templates if you wish, so each new super will be preloaded with preset values

    it may not seem immediately evident now, but there may be cases where you don't want the second super in an array to be exactly like the first, and vice versa, templates give you the ability to decide what goes in every super, without forcing you to put the same arrays in each one

    a few things of note, don't add objects into the templates, because object pointers change each time the program starts, so they would be invalid, you can add object types though. when you save and load supers to disk, you have the option to save your template data too. also, unlike arrays of anything else you can't access a super array outside of range and get the default

    meaning if your array has 5 supers you cant try to access index 9, and get access to the templates

    it really wouldn't make any logical sense anyway. but just so you know

  • why thank you minor

    btw, do you remember what the situation was where you needed a workaround

    it may be possible to bring this plugin up to a status of "use it this way"

    instead of my normal policy as of late "don't use it"

    I never had problems with it either

    another question, have you ever used it with multiple layouts?

    everytime people had problems using the plugin, their caps were always very different than I would have made them. there might be a dependable way to use this plugin yet

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Whoa. So you mean spritefont hasn't caused you any problems? That's awesome

  • Hmmm. Ill take a look when I get home. In the meantime if you can get the debugger to give a message(the s debugger actions, not the regular construct debugger). I might be able to figure it out with those, and if it crashes before the debugger can figure out why, it'll almost guarantee it is an s problem and not a user error

  • I'm not at home to look at the cap

    But I ve had to use find replace a few times recently

    And I can tell you what I've nopticed.

    First if you try to replace an object name with another object name and the second object doesn't exist or is missing something like a private variable it doesn't have it won't work, and it will give no error. It will crash on most conditions that contain any reference to a function object. Sometimes it will mess up your actions so they look strange in the event sheet, but when you doubleclick and reaccept it its back to normal, and sometimes it will look fine in the event sheet but when you doujbleclick a string is empty instead of containing what it had before the find replace.

    if its a large find and replace operation I would still use it, and try a few different actions or conditions individually, and maybe there is a common thread to the oness that crash.

    Every few successful find replaces save again with a new filename. Not as nice as a fully functional find and replace, but still better than manually changing 50 events

  • I agree with the others

    even more experienced members, myself included, find themselves overwhelmed after realizing what a project really will take

    start out with a simple 1 on 1 swordfighting game

    then maybe a whole beatemup level with the same mechanics

    if you start on that huge game now, you will probably never finish

    especially if you're worried about how often you'll have to ask for help

    also, construct has it's bugs and quirks, you need to get a feel for it as projects grow

    I wouldn't recommend undertaking anything huge until you get really comfortable

lucid's avatar

lucid

Member since 16 Jan, 2009

Twitter
lucid has 22 followers

Connect with lucid

Trophy Case

  • 15-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

22/44
How to earn trophies