Drag & Drop behavior on panel + bitmap Font

For questions about using Classic.

Post » Thu Jan 21, 2010 4:42 pm

Hello,

I have a problem here. I created a test Panel object and it seems that when i use the drag&drop behavior on the 'panel' i created, the caption text isn't moving with it. I attached the the bitmap font (spriteFont) with the panel, it is not moving with it.

Does anyone have this same particular problem? Is there a possible solution for this?

http://dl.dropbox.com/u/552137/Classic/CityMania.cap
B
1
G
2
Posts: 4
Reputation: 633

Post » Thu Jan 21, 2010 8:58 pm

When you're posting a dropbox link you need to put your file into the Public folder of your Dropbox folder, and right-click on it and select "Copy public link."

Or if you're using the web interface you click the down-arrow at the end of your file in the Public folder and select "Copy public link." That's the link you post.

The one you posted is the secure link to the file from your web login, we can't download that, so I can't see what's in your .cap.




Anyway, when you use the Attach action for the panel to attach another object, you don't move the panel, it's the other way around. You move the object, and the panel follows it. But you can't add a behavior to SpriteFont, so you can't set it to Drag and Drop.

So if you want to drag and drop a panel and have the text remain inside, you need to use the Attach action in the SpriteFont object. But just setting the position isn't enough, you need to refresh the text inside it:

[code:386znf11]
+ Always
-> SpriteFont: Attach to Panel
-> SpriteFont: Show text "Hello world!"
[/code:386znf11]

Now you can drag the panel around normally and the text will follow. The "Show text" action every tick will update the position of the sprites in the SpriteFont object. Otherwise, it just puts the sprites on the screen in one spot and leaves them there until you do something else with them.

Normally you don't have to use "Show text" every tick, only if you're moving the SpriteFont object around.

Attaching the panel every tick might seem like overkill, but if you don't then the text will lag behind the panel when you drag it. This fixes the issue, the text will remain firmly inside the panel. Normally, if your panel doesn't ever move, you would only need to attach it once.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Thu Jan 21, 2010 10:04 pm

Hey deadeye,

Thank you for your huge reply.
When i do a "show text" inside the allways condition, the game crashes :

The link is: http://dl.dropbox.com/u/552137/Classic/CityMania.cap
B
1
G
2
Posts: 4
Reputation: 633

Post » Thu Jan 21, 2010 11:45 pm

Hmm... I don't know what's going on there. When I tested it out in my own .cap, it worked fine. But in your .cap, I get the crash.

Unfortunately, it looks like a bug with SpriteFont. I would ask lucid about it, but he's said in his SpriteFont thread that he's not going to be fixing things, but rather he would like to start writing the plugin again from scratch. It's not something that you can put on the bug tracker because the Construct devs didn't make SpriteFont. I don't know what to tell you, I'm sorry :(.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests