1. PROBLEM SOLVING IN GAMESALAD
A major issue we had during this project was making the parallax scrolling background. At first, we
thought we had it covered. It seemed simple: we’d drag in 20 odd instances of the same background ,
line them up in an equal alignment horizontally leading off towards the left side of the screen and add a
move behavior to that one background actor a the 180 degree direction and watch as all the instances
moved, in sync, at the same speed. Perfect. It was just like our paper prototype, the background would
be rolled through the screen the old fashioned way. There we were sitting there ready to add to our
fantastic idea, naively assuming that it was entirely possibly just to loop the occurrence of the
background instances, when it occurred to us that our background wasn’t rolling too smoothly and it
lagged the simply yellow rectangle, that at the timed we called Chad.
This was because all the
instances of the background and
later, the buildings over the top were causing an overload of data and we realised that if we added
anymore assets in, the game would be more and more likely to crash frequently. There had to be a way
to decrease the number of instances. We understood that the problem was that too many instances of
the background were present at once; as the instances that had passed through the screen made an
exit off the left side, they just carried on going, meaning that they were inevitably still in the game. We
needed to destroy them so that once they were gone, they were gone. We came to the conclusion that
creating an actor purely just to destroy those instances and creating a spawning actor to renew these
expulsions.
Creating these actors seemed simple and I swiftly created a spawner and a destroyer and proceeded to
add in the rules of when the destroyer destroys the background upon overlap, the spawner spawns a
new background. The cycle and correspondence between the time that the background’s spawned and
destroyed was not equal and the backgrounds and buildings were being destroyed and spawned over
each other, on screen, in a big mess. The spawner needed further indication of when the backgrounds
were meeting the destroyer. A well placed attribute was required here and I later began to understand
whilst creating future assets for the game that attributes are a great communicator for behaviors in
GameSalad. I created an attribute exclusive to the background actor called “overlap”. When a
background was to be destroyed this attribute’s value would be set to 1. A rule was then created in the
spawner to show it that when the overlap attribute’s value was 1, a new instance should be spawned.
This proved to be very effective and actors began to spawn and disappear better. However, once I added
the buildings in over the top and made them move at a slower speed, I noticed that too many were
spawning at one time and that they were overlapping each other. To fix this, I created a simple
debugging system with two integer attributes that added a point to themselves whenever an actor was
spawned and destroyed and displayed them on screen so that I could count them and notice the
difference.
2. The only further issue we had with this scrolling technique was firstly, shrinking the buildings to the
correct size so that they spawned correctly in the game, an issue that arose from the fact that we
saved the PNGs from Photoshop in the wrong sizes. Secondly, there was a gap between the spawned
buildings on screen and the newly spawned buildings coming on to the screen but this was simply fixed
by altering their position on the x axis.