random(?) obstacles

lobosco_estudiolobosco_estudio Member Posts: 98
edited January 2013 in Community Tutorials
I'm working on a game, like this: (drive the frog. from the 5m15s)

But I'm having problems when placing the obstacles. put
them at random, but sometimes the timer appears on the obstacle, created
also a table, but it did not seem right. Anyone have any suggestions?

Best Answer

  • tatiangtatiang Posts: 11,948
    edited February 2013 Accepted Answer
    You can use a table or you can just spawn them. I'm not sure why you would use a table for this, unless you want full control (and non-random timing) over when obstacles appear. If you spawn obstacles, you just have a single spawner with a rule that picks a random number from 1 to 3 and then spawns the obstacle at a specific Y position based on the random value. If you wrap the Spawn behavior in an every 3 seconds timer, you'll have a randomly-appearing obstacle every 3 seconds. If you choose a random number for your timer as well, you can randomize that.

    In a sidescroller game like that, generally the obstacles have simple move rules (e.g. Move 180 direction 200 speed).

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


  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,948
    Sometimes the timer appears on the obstacle? Are you having trouble getting the obstacles to spawn at the correct Y values? Or are you having trouble with the positioning on the timer?

    It would help to see your rules.

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

  • dukie234dukie234 Member Posts: 12
    well i don't know how you design your game but let's say that the game play and level are identical with the example. you could create attribute that stored a boolean value for each road lane to detect what kind of actor spawned, is it the obstacles or the timer. and create an boolean attributes for each actor to switch to TRUE everytime they are spawned on stage.

    Now create a rule in obstacle and timer actor to detect if their Y position is the same to each other, then move one of them to the Y position of the other Road lane..

    Well that's a rough idea on how to detect which actor spawned, basically you must create many "switch" attributes since GS can not directly reference to other actor X or Y position on the scene except through stored X or Y value in an attributes.

    I hope it helps..
    Cheers! :)
  • lobosco_estudiolobosco_estudio Member Posts: 98
    Well, I'll try to explain myself better:
    say that my obstacles appear at positions y 90, 180 and 270.
    Much like the game Drive the Frog.

    Realize that drive in the frog appear to be random groups of obstacles.

    I created a few rows in the table with 6 columns
    Example: 90, 180, 90, 270, 90 180.

    the question is: Do I have to create multiple rows in the table and puts them at random? That is the only way to create obstacles?

    Thank you guys! :D
Sign In or Register to comment.