Changing Physics Mass property via an event

This forum is currently in read-only mode.
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • 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

  • 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.

    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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)