Ive spent 3 hours on a problem, I need some help

MammothMammoth Member Posts: 640
edited November -1 in Working with GS (Mac)
So I am making a fishing game. Everything is going great however, I have this one minor problem.

Basically I have it so that when the fish enter the lure zone the can be caught on the lure. I have 3 private variables when the fish is lured and caught.

The problem I am having is that I only want one fish to be caught. When the fish is caught all the fish in the lure zone all of the fish go into the lure. I have it set up so that there can only be 1 fish on the lure. However, the other fish in the area just sit there dead.

My partial solution is to see if self.motion,linear.x = 0 then move the fish left. But that didn't work.

Anyway I have spent a great deal of time on this. Does anybody have any advice :)

Thanks in advance

Comments

  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    How many instances of the fish are there in the Library? You might make an instance for every individual fish, so each one can have it's own set of rules and personal attributes, and wont conflict with other fish on the stage.
  • RedlerTechRedlerTech Member Posts: 1,583
    SlickZero said:
    How many instances of the fish are there in the Library? You might make an instance for every individual fish, so each one can have it's own set of rules and personal attributes, and wont conflict with other fish on the stage.

    ^^^SOLUTION
  • MammothMammoth Member Posts: 640
    SlickZero

    I have 2 atributes that are private for the fish
    IsLured
    IsCaught
    and a global attribute LureOccupied.

    The problem is that once a random number reaches 3
    IsLured and IsCaught become true and they all race for the lure at once.
    But when lure occupied is true the other fish just stop and do nothing..

    Is this game salads way of saying "you made a coding error". I feel that in other programs the game would crash .
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Actually, it's doing exactly what it was told to do. It sounds like a conflict in behaviors. How many kinds of fish are there? And if you are dragging the fish from the same single actor, they are going to conflict with each other because they have the same set of locked rules applied to them. You may have 10 fish on the screen, but they will act as 1. Each fish will have to have its own name, and own set of attributes referring to it. You may have to have 10 instances of the same fish in your library.
  • MammothMammoth Member Posts: 640
    Wow, this is more complicated than I thought.

    I guess what I need is to have Is Lured and IS caught variables for each individual fish.

    I want a lot of fish on the screen so I guess what I have to do is have a lot of dummy fish, that don't do anything and spawn a really catching fish one at a time. I know this will work, thanks slick.

    On another note I find my games to have ALOT of variables. It seems like with game salad you have to make way more variables than if you were to make a game with code. Does anybody else find this?
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Well, it would be the same with code, but with GameSalad you don't see the code, it just seems overwhelming because it's a drag and drop environment. It would be the same with code, just done differently. My first game had 3 custom attributes, and that was because I was scared of them. My new games have about 100 each so far, and are nowhere near completed.

    Deep Blue's Project Attributes program makes managing the attributes a lot less frustrating when you group them up in the list, so much easier to keep track of.
  • MammothMammoth Member Posts: 640
    Usually my projects have 50-100 attributes. So I guess that's normal. I would love to be able to organize the attributes alphabetically.
  • simo103simo103 Member, PRO Posts: 1,331
    Hey Mammoth .. I played around with an ice fishing project for the last TOTB contest (didn't get it finished) but I think based on what I did ... you could keep your single actor (multiple instances in scene) way of doing things.

    the issue is that a game variable of 3 is triggering all the self attributes to trigger. Would you consider doing a self attribute Proximity and then assign its magnitude to the hook. Based on a certain distance that could set the self attributes isLured and isCaught on that one closest fish and notify the Game attribute LureOccupied so all the other fish could keep moving even it they get into range?

    Not sure if it is a good solution based on your game play but it worked in my project.
  • SlickZeroSlickZero Houston, TexasMember, Sous Chef Posts: 2,870
    Mammoth said:
    Usually my projects have 50-100 attributes. So I guess that's normal. I would love to be able to organize the attributes alphabetically.

    Give this a look. This is the program I was talking about.

    http://www.deepblueapps.com/Deep_Blue_Ideas_Ltd./GS_Attributes.html
Sign In or Register to comment.