Quantcast
Channel: Active questions tagged game-maker - Stack Overflow
Viewing all articles
Browse latest Browse all 189

Game maker physics: using different restitutions in one object

$
0
0

I tried to make a game in which the player makes atoms. I'm really far in making a good looking and working game.

But now I want to make the atoms have different properties for different phases (solid, liquid, gas) I found that I can't use Phy_restitution because it doesn't exist, so I tried making three objects (solid, liquid and gas) and give them their own properties.

But this didn't work. The create event checks in which state the atom should be and creates that state, but this gives me a error.

How can I make three phases with different restitution of this atom?

------create event------ obj_h_parenttemp = global.tempif temp < 14 instance_create(x,y,obj_h_solid) instance_destroy()if temp > 14 and temp < 20 instance_create(x,y,obj_h_liquid) instance_destroy()if temp > 20 instance_create(x,y,obj_h_gas) instance_destroy()

the error that I got was:

FATAL ERROR in action number 1 of Create Event for object obj_h_parent:

PerformEvent recursion depth failure - check for infinite loops, check objects for parenting
at gml_Object_obj_h_parent_CreateEvent_1 (line 4) - if temp > 20 instance_create(x,y,obj_h_gas) instance_destroy()

I today tried to do it another way by making three objects and letting them check the temperature when they are created by:

temp = global.tempif temp < 14 instance_create(x,y,obj_h_s) instance_destroy()if temp > 14 and temp < 20 instance_create(x,y,obj_h_l) instance_destroy()if temp > 20 instance_create(x,y,obj_h_g) instance_destroy()

But when I ran it, game maker gave the same error as before. And I have deleted the parent.


Viewing all articles
Browse latest Browse all 189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>