connect actors

Tom24Tom24 Member, PRO Posts: 22

Hello Guys,

I'm working on a new game and have 1 big problem which I can not solve 100%.

I have a game area like a checkerboard, i spaw 1 actor with 6 different Images. (1 Actor in instead of 6 actors because the game should run smoothly and quickly)

For the position I use a table. and for the 6 random Images i use a "self- Attribute"

I want to connect the actors with the same image by touching (like the games "Crazy Kitchen" , "Blossom Blast Saga" or "Bee brilliant"..)

to see the connection I would use a spawn actor behavior (in the actor)

But my problem is, I do not know how to define, to spaw a new actor(to see connect) only at the same actors that was touched first.

for example: when there is a blue, green, and red actor. when the player touches the blue actor (and the touch is pressed), he should be able to just pull to the other blue actors in the environment.

Please help me, I have already tried a lot of variations, but unfortunately i do not come to a good solution.

if there is a better solution than spaw actor to make a connection. I must not use spaw actor. I just thought to myself that it works so most

I apologize equal times for my bad english, unfortunately it is not my mother tongue

Thank you.

Regards,

Thomas

Comments

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    there is no problem having many actors. It's all about how lean your code is. You're going to need to define in the code of your actors what they are. So a self integer that identifies the actor type or by using a tag. The main actor will also need to know it's identity and then it will need to report it's X and y position to game level real attributes. So a basic example would be this below

    Main blue

    Constain game.actor.blue X to self.position X
    Constain game.actor.blueY to self.position Y

    Rule

    When touch is pressed

    Change attribute game.blue.active to 1

    Timer after X amount of time
    Change attribute game.blue.active to 0

    Spawned actors

    Self integer attribute called color
    ( 1-blue, 2-yellow, 3 red et...)

    Rule

    If self.color = 1 and game.blue.active = 1

    Move to game.actor.blue X and game.actor.blue Y

    Rule

    When overlaps and collides with actor blue

    Constrain self.position X to game.actor.blue X
    Constrain self.positon Y to game.actor.blue Y

  • Tom24Tom24 Member, PRO Posts: 22
    edited April 2016

    Hello,
    Thank you for your answer!

    maybe I do not understand what you mean. but unfortunately that does not work well.

    I made a short screen record of my game, maybe do you see a error, or a thinking error of mine.

    Thanks

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922
    edited April 2016

    Okay so the first error I see is that you use a naked change attribute to add +1 this will only fire once. That video doesn't help as I have no idea exactly what all the mechanics are you are after. If you have six different types of actors make 6 actors not change the image. This is totally inefficent as you will have code in that actor that relates to the other five options that will be doing nothing. This approach does not make your game smooth and efficient, quite the opposite infact. It is more efficient to have 6 seperate actors with the associated code for it.

  • Tom24Tom24 Member, PRO Posts: 22

    Ok Thanks, initially I tried it first with 6 different. but I had problems with the positioning of the actors.

    I try it again with 6 different, maybe I get it then to connect only the same actors.

  • Tom24Tom24 Member, PRO Posts: 22

    Ok, so i thing i did it!

    moved the first great trouble,

    the next waiting probably already :-)

    but it's also my first game, i think this is normal.

    Thanks #Lost_Oasis_Games for your help

    Regards,

    Thomas

Sign In or Register to comment.