linkman2004's Recent Forum Activity

  • I haven't found anything that runs on XP that doesn't on Windows 7. Event X-WIng vs Tie Fighter from the Windows 9x days runs.

  • You can check if a number is odd or even by using the modulo(%) operator. Since the modulo operator finds the remainder of division, if n % 2 = 0, the number is even.

  • That does indeed seem to work, however, I'm still having serialization problems. I'm not having crashing problems or anything, but upon loading of a runtime save, the collision mask seems to be forgotten. Here's the serialization code(the three dots just represent the other variables I'm serializing):

    void ExtObject::Serialize(bin& ar)
    {
    	if (ar.loading) {
    
    		// Serialize all runtime info
    		ar >> info >> ... ;
    
    		// Set groups back up
    		SetupGroup(0);
    
    	}
    	else {
    
    		// Serialize all runtime info
    		ar << info << ... ;
    
    		// Clear the groups vector
    		groups.clear();
    
    	}
    }[/code:wkw8e52u]
  • How do I go about making use of a texture's collision mask? Does it have something to do with info.curTexture or info.imgHandle?

    Also, my drawing code is just using renderer->SetTexture(...), then renderer->Quad_xywh(...). Is there some other way I should be drawing things?

  • I'm using it for my Sprite Button plugin, which is how it supports custom shaped buttons. Here's what I have now with OnFrame():

    BOOL ExtObject::OnFrame()
    {
    	// Set the collision mask for this object
    	// iTextureD is the main button face texture
    	pRuntime->GenerateCollisionMaskFromTexture(this, iTextureD);
    
    	// Don't call anymore
    	return 1;
    }[/code:3piu01s7]
    And here's what I was doing in OnCreate():
    
    [code:3piu01s7]void ExtObject::OnCreate()
    {
    	// Load the edittime data that was serialized.
    	bin ar;
    	ar.attach(info.editObject->eData, info.editObject->eSize);
    
    	// Read the data.  Same format as you exported in EditExt::Serialize.
    	// Your runtime loader must be able to load all versions!
    	int Version = 0;
    	ar >> Version;
    
    	// Texture loader thingy
    	ImageHandleInfo* imgTexture;
    
    	// Load the default texture
    	imgTexture = pRuntime->LoadSerializedImageHandle(ar);
    	iTextureD = renderer->CreateTextureFromHandle(imgTexture);
    
    	...
    
    	ar.detach();
    
    	...
    
    	// Update the object's collision mask
    	pRuntime->UpdateBoundingBox(this);
    	pRuntime->GenerateCollisionMaskFromTexture(this, iTextureD);
    
    	...
    }[/code:3piu01s7]
    The first method works fine until I load from a runtime save, and the second one crashes upon loading a runtime save or when there are multiples of the object.
    
    Also, as a side note, the serialization code(not shown) is merely loading/saving some variables, so I don't think it's causing any problems.
  • I have some questions regarding the GenerateCollisionMaskFromTexture() function.

    First of all, where's the best place in the code to call this? I've tried calling it from OnCreate(), but the runtime crashes when two of the same object are present. Right now I have it called from OnFrame(), which is set to not call again after the first time, which works, but I don't think it's the best solution.

    Also, I'm having problems regarding runtime serialization after using this function to generate a collision mask. Everytime I load from a quicksave, the runtime crashes when it tries to generate a new collision mask. Is this something wrong with my plugin or Construct?

  • Why not, isnt this a behavior and event situation?

    Yes, but this board is for questions pertaining to development of new plugins and behaviors as can be seen in the board description:

    "The SDKs and effect development."

  • HUGE new update now up!

    Sprite Button Plugin - v0.5a

    Download Now(with example) - 109KB

    Adds/Changes/Fixes:

    ADD - Check box button type added. Along with these come new conditions/actions for using them(C-Button is ticked, C-Button is ticked by ID, A-Tick button). Check boxes can be ticked from the start(which is represented in the layout editor) and display different text while ticked. A special "Check box" properties section appears when this button type is set.

    ADD - Two-state button type added. These have the same features as check boxes but resize like normal buttons and allow for icons.

    ADD - Confine text option in the edit-time properties. When checked the text will be confined to the borders of the button. Unchecked will allow text to go outside the edges of the button.

    ADD - Actions for altering text attributes: text, font, color, size, position, offset values, ticked text.

    ADD - Actions for setting group and identifier values. NOTE: Groups are a feature that will be used for radio buttons in the future.

    CHANGE - Edit-time properties have been shifted around and added to different groups for clarity and usability.

    CHANGE - Behaviors are no longer allowed for the sprite buttons. This would mess with the collision mask offsets on check boxes and radio buttons.

    CHANGE - Button clicks are now detected through collision detection, meaning buttons can now be whatever shape is desired. The collision mode must be set to per-pixel for this to work.

    FIX - Confined text could go off the edges of the button.

    Just a warning to those with CAPs already using this: I've done as much as I can to make sure that existing CAPs don't break, but I can't be 100% sure. It's best that you back up your files before trying out the new plugin.

    Well, that's about it. The included example shows off both check boxes and non-square buttons, so it should give people a pretty good idea of how things work.

    As always, PLEASE be sure to respond with feedback and any problems you have. If you find a bug, be sure to report it to me!

    Have fun.

  • The U and V values are pretty much equivalent to X and Y positions, but for texture coordinates. They stand for the point on the texture that associates with a vertex. In Construct these coordinates are actually numbered like screen coordinates rather than values from 0.0 - 1.0.

    Here's an image showing an example of UV coordinates:

    <img src="http://dl.dropbox.com/u/917406/UVexplanation.png">

    Since Construct's sprite meshes require displacement values, these wouldn't be the actual values. The real values, starting with the left square, would be 0, 0 all the way around; the right square, on the other hand, would -- going from the top-left corner around clockwise -- have these values:

    1 - 0, 0

    2 - 128, 0

    3 - 128, 128

    4 - 0, 128

    Hopefully I explained all of this well enough and that I got the main idea across. Hope this helps.

  • You don't have a mouse and keyboard object in the "Menu" layout, so the "On click" conditions are never triggering.

  • I'm getting a little issue with the button automatically setting clicked state if the window pops up and the cursor is over the button.

    It could be the current version I have, but I can't seem to reproduce this

    Also mouse is over button doesn't seem to register.

    Ah, this is due to the fact that the object isn't capable of collision checks. That will change in the future.

    Then a small suggestion. A check box for unconfined text wrap beyond button size.

    I'll throw that into the next build

    And finally a small... er ok not so small suggestion. How about linking states to the animator?

    Might be interesting to animate the buttons.

    That would be a tough one, so I don't know how likely it is to happen, but I'll look into how it would work.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The expression I gave you does work(I made sure to test it), so I think it's probably something else in your code. Unfortunately, I don't really know what's going on with your code, so I can't help with the problem. Would you mind posting a CAP?

linkman2004's avatar

linkman2004

Member since 15 Jan, 2008

Twitter
linkman2004 has 1 followers

Trophy Case

  • 16-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Email Verified

Progress

18/44
How to earn trophies