Changing Physics Mass property via an event

For questions about using Classic.

Post » Thu Jan 27, 2011 6:47 pm

Hi!

I am having problems with the physics behaviour of sprites, more specifically, with the mass attribute. I would like to change the mass attribute via a checkbox in-game, but whenever I tick the checkbox, the sprite freezes on the spot.

Can someone please enlighten me as to what my error is? I have attached a .cap file to demonstrate the problem.

Regards,
JFK

www.juergenkoller.at/MassTest.cap
B
1
G
1
Posts: 2
Reputation: 429

Post » Thu Jan 27, 2011 7:32 pm

You're most likely getting the same Issue as I am here. Your sprite isn't freezing, but the checkbox is stealing focus, so no keys will work.

viewtopic.php?f=3&t=8381\

EDIT: I noticed that after clicking the box, then clicking out of the window, then clicking back in, it restored focus to the keys. Perhaps with the window object and a specific event, you'd be able to do some tricks to refocus the window to it's proper state.
B
2
S
1
G
1
Posts: 38
Reputation: 676

Post » Thu Jan 27, 2011 8:09 pm

My solution was to add a backdrop to the GUI, it can be invisible. But once the mouse rolls over it, it sets a value to 1. When you click anywhere off of that and the value is set to 1, then it hides the window, shows the window then brings it to front. I assume you could also minimize then restore the window, either way theres going to be an obnoxious flash. In your case, you can always just change the "click anywhere off of that" to press any key. It might not be the best way to do it, but it's the only way I've been able to get it to work without running into a broken command. Perhaps someone else might be able to use this knowledge to come up with a better solution.
B
2
S
1
G
1
Posts: 38
Reputation: 676

Post » Thu Jan 27, 2011 9:28 pm

Hey, thanks for your help! I started trying your solutions, then a friend came up with a solution:

In the event, you need to 'Insert new condition' -> 'System' -> 'Trigger once while true'.

Apparently, at least in my case, the event is checked every tick and the program cannot cope with that (it's an assumption, I won't claim to understand the underlying happenings of construct :) ).
Thing is, that solution did not work with my example .cap file that I provided, but it did work with my main program... having looked at your topic where you provided the link, R0J0hound provided a (more elegant?) solution to your problem, so hopefully your problem will also be solved!

Regards,
JFK
B
1
G
1
Posts: 2
Reputation: 429

Post » Thu Jan 27, 2011 11:27 pm

That's a great solution, although I'm not sure how that would work for edit boxes, I have a few assumptions, but I think I'm just going to let it be and stick with what I've got. It only happens during the level editor so as long as it doesn't happen in game I'll be just happy.
B
2
S
1
G
1
Posts: 38
Reputation: 676


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests