How to create arrays of blocks or coins?
I want to create coins arranged in a particular shapes for example arrows or rockets.
They need to be different prototypes of same actor. So arranging like arrays in normal programming will be the option.
How do I achieve this in GS?
They need to be different prototypes of same actor. So arranging like arrays in normal programming will be the option.
How do I achieve this in GS?
Comments
If not, the easiest way is to make a table, and basically grid out everything in the table.
So if it's coins, put C in every cell of the table and "draw" your arrow in the chart.
Then any time you want to make an arrow, you call a rule that scans the table and puts the coin object in that place.
Make variables to help you scan the table. So Row=1, Column=1. After you draw each coin, you add to each. This way it scans the table and keeps moving across it.
if Row, Column of Table =C, the spawn a coin object at (whatever place you wanna put them). Of course you'll want to offset based on the size of the coin and spacing.
So Spawn it at x coordinates =50xRow and y coordinates =50xcolumn, for example, if the coin is like 40x40 and you want a space of 10 between them.
Keep in mind if you start at a certain location, you need that offset for all the coins. So like if it's 50, 60, for example, the coins are spawned at x value =50 + 50* Row
@hotMagic yes the coins are moving, so I believe the tables not going to work?
I want to fill each cell with an animating coin moving to the left.
Now how do I call an actor in table?
I need to use random cells to create different patterns, how to give the coordinates for each coin called?
When spawning an actor in the x cordinate I am calling cell value table but it calls only one row one column.
How I can call one complete row and use only one column and vice versa?
Just iterate the cell row or column number and then add a spawn behavior with the x/y locations based on the row/column value.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
currently I have a made an attribute for spawning coins when that is on, I am calling each coin from the table and making them arrange in such a way that they look like a shape or text.
But calling each cell individually is taking a lot of time and behaviors.
That way, as the self. (or game.) loop counter attribute increases, the table row number increases and the loop spawns an actor at each table row's x and y values. The y position field just has the same expression but with table column "y" at the end instead of "x".
EDIT: That should be Relative to scene, not actor.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Can you help me out here also, just scroll down to the end.
http://forums.gamesalad.com/discussion/40282/scrolling-background-not-using-scene-wrapping-please-help
I am badly stuck as the backgrounds are not looping properly anymore because I am pausing the screen which makes the new spawn to overlap the old one. I am using the spawn and destroy behavior for looping backgrounds.
http://forums.gamesalad.com/discussion/comment/348903/#Comment_348903
I think the above link interpolate method can work better but the coordinates are not working for ipad 1024 x 768 resolution.