How to Change Interactive Size of Actor ∆ or ≠ Image Size

Hi Community!

Getting into game dev here. Encounterd a hurdle I can't find (googled + search forum) a solution for...

I've got an actor I want to interact with another actor but I don't want the image size to be the discernible boundary for that actor.

How do i make the game treat the image as a smaller actor. In this case, I wish to make the interactive size smaller than the image the actor uses.

Appreciate the assistance!

Kind regards,

Worldranger

Best Answers

  • tatiangtatiang Posts: 11,949
    Accepted Answer
    As was mentioned, magnitude may be the answer here. If you can describe a bit more about how your game works and/or post a screenshot, we can probably come up with a better way to do this.

    Magnitude is a built-in math function in GameSalad:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • RThurmanRThurman Posts: 2,880
    edited November 2013 Accepted Answer
    1) Put the proximity sensor in the missile (not the target). And use an actor attribute (not game attribute) to record distance.

    2) In the missile actor:
      a) Rule: When a missile is near the target's center:
      b) Spawn a detonation actor at the missile's location.
      c) Blow up the missile (particles)
      d) Destroy the missile actor

    3) In the target actor:
      a) Rule: When overlap/collides with the detonation actor
        a1) do the destruction sequence for the target actor

    4) In the detonation actor:
      a) Rule: When overlap/collides with target actor
        a1) After .5 seconds do a destruction sequence for detonation actor

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2013
    Another way is to constrain a smaller "mask" actor that is invisible (self.color.alpha set to 0) to the larger actor's x/y position and put any collision rules in the mask actor.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • worldrangerworldranger Member Posts: 10
    edited November 2013
    Another way is to constrain a smaller "mask" actor that is invisible (self.color.alpha set to 0) to the larger actor's x/y position and put any collision rules in the mask actor.
    Hi There. Yep I did that for one of my actors but the problem being is that the other acotrs I am now trying to affaect spawn randomly and have a unique chase pattern i.e. I don't know a way for them to also generate a 'ghost' actor that will follow the same route.
    One suggestion is to use the Magnitude function to limit interaction only at a certain distance. You can search for the magnitude demo, and then use that distance to determine when the other actor should interact
    I will try that - I've never heard of the 'magnitude function'
  • worldrangerworldranger Member Posts: 10
    I'm not sure how to use this webpage to discern how I use the magnitude function guys sorry... is it expecting me to download the game and then reverse engineer the process? I can't seem to figure out how to download the game...
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited November 2013
    I don't know that you'll want to use constrained actors for that as it affects performance to do so but if you're interested I made a health bar demo that constrains two actors' movements and allows the game to know which actor goes with which constrained actor.

    http://forums.gamesalad.com/discussion/comment/384027/#Comment_384027

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • worldrangerworldranger Member Posts: 10
    edited November 2013
    I've created another ghost actor that is 1/10th the size of the visible anchor and - because image size doesn't affect amge physics - its moves in the exact same way as its bigger brother. Now the only problem is that the large guys still destroy themselves when they touch the target actor.

    I've got to get it so the larger visible actor only destroy itself if/when its smaller ghost actor does so.

    No idea how to do that! There must be a better way to do this without having to create duplicate actors all the time of different sizes!
  • worldrangerworldranger Member Posts: 10
    Thanks again! But that doesnt seem to be working. I've tried doing a distance function but I multiples of one actor and I think its confounding the math.

    Basicially I have a target that I am shooting with missiles. The graphic for the missiles is much large than the actual size of the missile should be. Therefore it was hitting too soon. I solved this by creating two ghost actors (smaller than both of the graphic actors but identical in everyway) that when interact with each other cause damage.

    The problem I have now is that the larger graphic actor is still destroying itself too soon giving the impression that it didn't hit the target and exploded prematurely.

    I wanted to use the distance'from attribute to let it only destroy itself if it had reach a certain distance and indeed technically graphically somewaht overlap the target ghost actor and only have the missile destory itself once its core had touched the target actor.

    Does this make sense?

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    The graphic for the missiles is much large than the actual size of the missile should be.
    I'm curious about this. Is it just not cropped well or is there a reason for having a larger image and a smaller collision area?

    Why is the larger graphic actor destroying itself too soon? What rule are you using to achieve that?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • worldrangerworldranger Member Posts: 10
    The reason for the large image is special effects. Only the centre of the image is the 'deadly' bit.

    Currently There is a smaller invisible actor that follows the path of the larger actor. When the smaller actor collides with the target actor it causes damage.

    I am trying to get the larger actor to NOT dissapear when it interacts with the target actor but only if/when its smaller invisible actor sibling collides with it.

    Currently I am using a rule to say if it collides with the target actor it destroys itself.

    I tried using the other code but when i'm not sure if its measuring from the center of the actors or what - either way it doesnt seem to be working!

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Well, you could have a game boolean that changes to true when the small actor collides and then use that boolean as the rule condition for the large actor. But if you have more than one missile (small/large actor pair) in the game, that won't work.

    Have you considered particles instead of a separate large actor for the special effects?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • worldrangerworldranger Member Posts: 10
    Thats kinda the problem I think - the distance calucation is trying to calulate the distnace of ALL the missiles at once and messing up.

    I guess that boolean would have the same issue.

    I have considered particles but it just wouldn't look right for what I'm doing.

    There must be a way to stipulate an 'overlap' situation.
  • worldrangerworldranger Member Posts: 10
    Hi RThurman -

    Thanks for your input!

    I've already implemented the timer delay as the only way I can get the Missile Effects to destroy itself. Problem being that it still self destructs if the graphic touches the target actor even if the target actor is not hit by the 'detonation actor'- this is not ideal as it can leed the player to think he either was hit and it didn't record the hit or that the missile is gone and then get hit by the 'detonator actor' thats invisible and still tracking him.

    What do you by 'put the proximity sensor in the missile' we're talking about game coding here - there isn't actually a real 'proximity sensor'

    This is how it WAS

    game.Distance From = game.target X - self.Position.X , game.target y - self.Position.Y

    Where Distance From is a Game Attribute Integer and self is the missile thats how its set up already.

    I've now changed it to

    self.Missile Distance From = game.target X - self.Position.X , game.target y - self.Position.Y

    Ive set the destroy to when self.Missile Distance From = 0
    then
    Destroy this Actor.

    But it seems that the actors just destroy themselves as soon as they are present - i think it has something to do with the math...
  • worldrangerworldranger Member Posts: 10
    Hold on I just realised that the 'magnitude' bit was missing from the equation! DUH! Lets see if I can make it work now...
  • worldrangerworldranger Member Posts: 10
    YES! Got it to work - simply forgot to put the bloody Function in there. It now records great and with it being coded within the missile itself they now destroy on CONTACT

    EXCELLENT THANK YOU EVERYONE!

    I hope to show this project soon. Is there a good place to show off beta projects?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    @worldranger Some people post in the Announce Your Game subforum and state that it's a work in progress (WIP) -- often in the thread title itself. You can also post here and/or start a new thread for your in-progress game.

    Glad to hear it's working! Nothing like crowdsourcing to solve problems, eh?

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.