Need Help With Little Project. Experienced Users Please Help!

cbtcbt Member Posts: 644
edited November -1 in Working with GS (Mac)
Hi,

I've been trying to do this for a long time now. But everything I try fails. I'm going to try to explain the issue but, sorry for my English, if you don't understand any part please ask.

I'm trying to make a simple "car" and "lights" game.
A spawner spawns cars, and if cars collides with "red light" they stop, if "green" they pass.
But here is the tricky part;

When any spawned "car" collides with another "car" it should stop. (Like the cars waiting to light to turn green.). But when light turns "green" they should keep going.

I've tried a lot of things. I've uploaded the games for you to see.
Basic version (The "cars" just stops at "red. Nothing else.) : http://gamesalad.com/game/play/45254

Last version (Tried to add "score" actor to trick the game but not working) : http://gamesalad.com/game/play/45252

What I want is the "cars" to line up when the light is "red". And when the "light" is "green" they should keep going until the next "light"

Please download the games and have a look. Any help is appreciated. Thanks in advance..

Comments

  • Pas976Pas976 Member Posts: 41
    i think you would need to add an invisible traffic lane actor and change the rules to say: If overlaps or collides with actor of type: traffic lane AND light is equal to red they would go. if they are outside of the lane they could go automatically
  • synthesissynthesis Member Posts: 1,693
    yep...Pas has it I think
    Try an invisible "forceField" connected to each car. Then if another car hits the forceField...it will stop. If it doesn't touch another cars forceField...it goes forward.

    One other tip...
    Don't spawn the cars and the forceFields...Have them in the scene at all times and use alpha to turn them on and off and off screen X or Y position values to make them irrelevant within the game.

    PS:
    Your English was excellent.
  • design219design219 Member Posts: 2,273
    I'm curious, what is your native language? Like synthesis said, your english is better than most Americans.
  • synthesissynthesis Member Posts: 1,693
    On second thought...
    An easier, simpler and more elegant solution might be to get a PNG file placed in the actor. Then leave some transparency in the image behind the car (or all the way around it if necessary). So if the car image were 50 px long...make the png 60 px long and the extra 10 px should be transparent. Then you will get the "stacking" effect you are looking for.
  • cbtcbt Member Posts: 644
    @Pas976;
    I'm currently trying what you've said. And I will report in few minutes.

    @synthesis;
    As I said, I'm trying the "Lane" way right now. But I don't think the second way will work. Well, it will put a "space" between two cars, and will add a nice look, but still not solve the stop-and-go issue :)

    @design219;
    My native langueage is Turkish :)

    Thank you all guys. I will try it now.
  • cbtcbt Member Posts: 644
    Well, it is not happening...
    http://gamesalad.com/game/play/45291

    Am I doing something wrong?

    And 'synthesis' I didn't understand the "force-shield" thing. Can you explain more?
  • cbtcbt Member Posts: 644
    Little help please...
  • synthesissynthesis Member Posts: 1,693
    For every car...have a forcefield overlay actor with a transparent png in it that is the size of the "space around the car" that you want.
    Then constrain the forceFields X and Y position to the game.car1X and Y (which are reported to the game attributes via constrained attributes in the car). This will provide a real time positioning relationship between the car and the forceField and cause the FF to be in the same spot as its parent car at all times. You may also need to connect their rotation if your cars turn.

    Then you can put "driving" rules on your car actor and "traffic control rules" (or colliders) on the forcefield actor tagalong.

    Repeat this for each car.
    It wil be better on the processor if you don't spawn...just recycle actors over and over again. Once they leave the screen (or arrive at a "destroy" point) just move them to the spawn point and reset all their settings. Turn off their alpha and have them wait there until you need them again. then if you need them...throw a "launch" boolean switch and reloop their behavior sequence.

    This will make your game perform 10 times faster and smoother than if you use spawning.

    TIP:
    3 things to use sparingly as if they were made of gold...
    1) Timers
    2) Constrained attributes
    3) Spawned actors

    All of these are drains on the processor...too many of them and your game's performance will suffer.
Sign In or Register to comment.