Questions about the logic in the Alien Conquerors default template

osakamitsuosakamitsu Member Posts: 70
edited June 2014 in Working with GS (Mac)

Hello, I decided to try and get a better handle on gamesalad by trying to reverse engineer the templates given with the program. But a couple of things have stumped me so far.

I think I understand part of one of my questions but I want to know if I am on the right track or not.

Keep in mind there is a game attribute for "AlienCount" and it's an integer set at 0 by default. And the alien ships each have a change attribute behavior that adds +1 to the AlienCount attribute.

What I think I understand is that by default the alien ships each add +1 to the AlienCount attribute. There are 15 alien ships in the scene, therefor the AlienCount attribute reads 15 and not the default 0 that you see in the editor. It only reads the 15 when the game is functioning and you cannot visually see it. When A ship gets destroyed, the game loses a +1 to that 15, therefor gets one subtracted without having to use a subtract expression. When it reaches 0, the level/game is over. Is that correct so far?

Now the part that really confuses me.

Inside the players ship logic there is a Timer that says after 5 seconds execute the following rule that says "When all conditions are valid, attribute game.AlienCount equals 0, then change attribute game.MoveDirection to 1 and another that says change to the next scene.

To me assuming I am correct about the attribute a couple paragraphs above, this says once all the alien ships are destroyed then change to the next seen. What confused me is why is there a timer? And why does it say after 5 seconds? I don't see anything in this template that initiates after 5 seconds. The only thing I can think of is that the timer blocks you from completing the level within 5 second of the game start assuming that is even possible. Can anyone shed some light on this for me? What does the game.movedirection attribute have to do with the enemy count or scene change?

Also I see some of the movements are 1 and -1. Is this just another way to say move left or right instead of degrees? Why make a Game.MoveDirection attribute for it rather than using move behaviors?

Thanks for your time reading my questions. Any help is greatly appreciated! :D

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited June 2014

    Is that correct so far?

    Correct so far. :)

    What confused me is why is there a timer?

    Great question. It's not obvious at all but once you've used GameSalad for a while it would be. If you have a rule that checks game.AlienCount to see if it's zero, that rule will "fire" as soon as the scene begins. The reason for the timer is that the alien actor may not have run its change attribute behavior yet to add one to game.AlienCount. So we need a slight delay to allow all of the alien actors to increase that count before we check to see if it's zero (meaning all of them have been destroyed). I usually use a short timer such as After 0.5 seconds for something like this.

    What does the game.movedirection attribute have to do with the enemy count or scene change?

    I'm not sure... it's been a while since I've looked at that template... but I'd guess that the movedirection attribute is being reset for the next level. And yes, -1 or 1 are just stand-ins for the direction. If you use an attribute for the Move behavior, you can then change the direction by altering the value of the attribute rather than using multiple different move behaviors. It's more efficient but not necessary.

    When I first learned to use GameSalad, I cut my teeth on Alien Conquest and then made a video tutorial series for my students. It takes you through step-by-step instructions for creating that game (although I modified it a bit). You can see it by clicking the link in my signature.

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

  • osakamitsuosakamitsu Member Posts: 70
    edited June 2014

    Thank you for your great reply. I thought maybe that it was being reset for the next scene but then I thought that since the next scene has all of its own attributes would it really need to rely on the first scene resetting the attribute for it?

    And wonderful about the video tutorial! I will definitely be checking that out!

    Can anyone else can the question about the game.movedirection attribute or at least confirm what tatiang suggested it could be?

  • osakamitsuosakamitsu Member Posts: 70
    edited June 2014

    Alright I am stumped on something else now. Looking at the Bullet actor there is a rule that tells it to be destroyed when it's self position is less than 10. But 10 is way below at the bottom of the game scene, far lower than it would ever be shot. I thought well maybe wrap y was enabled but it is not. I can see the reason for needing to destroy the actor but I am really confused why it would be destroy at the bottom like that and not just off the top of the game scene. Does't this mean that the bullet never gets destroyed in this template? Does it ever even reach less than 10?

    screenshot of the rule in question:
    [IMG]http://i.imgur.com/fWn0DpD.png[/IMG]

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Game attributes do not get reset when the scene changes. So if their values need to be reset, this is done manually with a change attribute behavior.

    Hmm... I'm not sure why it's destroyed when Y is less than 10. Combing through a basic template is a great way to learn GameSalad. But I would also say that if something doesn't seem necessary, such as that rule condition, then try building the game without it. If the bullets aren't working right, you could always add that condition back in... but I doubt you need it.

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

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    edited June 2014

    Screen wrapping on the Y was initially part of the project for the stars. So when the bullets came across through the other side, they wouldn't be seen again.
    So if you remember the old Galaga such games like this, when the enemy comes down to attack and you don't destroy them, they come back from the top. This project doesn't go that far to do that, but I think I wanted to do that at one point too.

  • osakamitsuosakamitsu Member Posts: 70

    Awesome thank you so much guys! :D

  • Mudassar YasinMudassar Yasin Member Posts: 2

    Dear experts, I am having issues in game salad template alien conqueror. While doing reversing engineering, I could not find game attribute accelrometer in attribute panel, though it is used in programming of player ship. likewise, I see attributes like QQscoreboard and QQachievment while opening attribute editor in backstage panel, but these attributes are not shown in attributes panel. Please, guide.

  • osakamitsuosakamitsu Member Posts: 70
    edited March 2015

    @Mudassar Yasin

    Some of those attribute are listed in the game/scene/actor attributes are not actually used. My thinking is that this was a template that the developer used to create multiple templates and he/she just left them in there. If there are no logic accessing the attributes then they are not being used. If you look at the other default game templates that game salad allows you to download you will see that they are used across more than one template.

    Example: There is a game.purchases table attribute that was created and not there normally. This game obviously has no way to purchase anything, so it isn't used.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited March 2015

    @Mudassar Yasin

    I assume you're using the file here: http://gamesalad.com/manuals.

    The accelerometer attributes are in the Devices section of the Attribute Browser:

    The other two you mentioned are tables and are listed under the Game section of the Inspector and also in the Tables tab/button:

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

Sign In or Register to comment.