monitoring if owner has something mounted to him
by rennie moffat · in Game Design and Creative Issues · 01/25/2010 (12:10 pm) · 3 replies
Hi There,
I am building a game where by I need my player to pick up, and drop a chip. The player can only pick up a chip if he currently has no chip mounted to him.
My question is who to attach the behavior to. I am thinking of simply having one behavior to govern everything. And since my chip, needs collisions active all the time, even once it is dropped by the player (remember he must pick a chip up, drop it, come back for another) and my player doesn't need any collisions active I am thinking of attaching said behavior to my player. This is because I can turn collisions on if he has no chip, but turn them off if he does, therefore he can only pick up one chip at a time.
My question is, %this.chip.getIsMounted() will see if a chip is mounted to anything. But what, I need to allow my player to be the one who checks since a chip is mounted to him. So how best can I monitor whether or not my player is holding a chip?
I am going to use something like this...
if chipMounted to owner
owner collision send is false
if chipNotMounted to owner
owner collision is true
So again I will need to figure out how my owner can see if a chip is mounted to him.
I am building a game where by I need my player to pick up, and drop a chip. The player can only pick up a chip if he currently has no chip mounted to him.
My question is who to attach the behavior to. I am thinking of simply having one behavior to govern everything. And since my chip, needs collisions active all the time, even once it is dropped by the player (remember he must pick a chip up, drop it, come back for another) and my player doesn't need any collisions active I am thinking of attaching said behavior to my player. This is because I can turn collisions on if he has no chip, but turn them off if he does, therefore he can only pick up one chip at a time.
My question is, %this.chip.getIsMounted() will see if a chip is mounted to anything. But what, I need to allow my player to be the one who checks since a chip is mounted to him. So how best can I monitor whether or not my player is holding a chip?
I am going to use something like this...
if chipMounted to owner
owner collision send is false
if chipNotMounted to owner
owner collision is true
So again I will need to figure out how my owner can see if a chip is mounted to him.
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
01/26/2010 (1:06 pm)
1 suggestion (and probably not the best) would be to set a global level var $chipIsMounted = false;. Once the chip is mounted to the player, flip the var to true. If there are multiple players, try adding the property to the player datablock as a dynamic field (chipIsMounted = false) when the datablcok is first loaded. Once you mount the chip, flip that to true (PlayerDatablock.chipIsMounted = true). Also, I think there is a method that checks if an Image is mounted to a specified slot that may work as well. Hope this helps.
#3
Thanks!
01/26/2010 (1:16 pm)
Yes it does, i am simply thinking of applying an area, which my player must cross in order to be picked up.Thanks!
Torque Owner rennie moffat
Renman3000
I have discovered that using a collision to trigger the mount ain't happening, well at lest for me mind I currently cannot get it to mount at all.
If anyone has some insight on this please let me know.
Essentially, what I want to do is have my player pick up an object.