0 Reputation

# question about left to right sprites

Forum Home > Construct 2 General > How do I....?
 Author Message    Topic Search   Topic Options 416 Rep 1 Post Options    Quote  Reply Topic: question about left to right sprites    Posted: 06 Mar 2012 at 5:11pm Hello all,I am new to construct 2, but I love it. I have a small problem. I want to make a freeway clone. Freeway was an atari 2600 game from the eighties.A chicken had to make it from the bottom of the screen to the top while avoiding cars. The problem I am haveing is I dont know how to make the cars come from left to right from off the screen and then keep coming in their line of traffic. I have all the sprites the background, this is the only issue i cannot figure out. I know if i could get one car to work, I could just clone it to other parts of the screen. Anyone have any idea's.thanks in advance,bj 1,008 Rep Post Options    Quote  Reply Posted: 06 Mar 2012 at 5:13pm Spawn a car from time to time and make the car have the BULLET behaviour. By setting it's angle (0 -> and 180 <-) they will move. 9,130 Rep Post Options    Quote  Reply Posted: 06 Mar 2012 at 7:52pm orcar: Set X to self.X+a*dt a in this case is amount of pixels per secondif you setcar: Set X to self.X+100*dt - car will move 100 pixels per second 416 Rep 1 Post Options    Quote  Reply Posted: 07 Mar 2012 at 2:23am Thanks for all the help, but I admit I still dont understand. I want say 7 cars that scroll vertical across the screen at random times, but I also want them coming at random from left and right also. So there is 7 lanes of traffic the car sprites only travel vertical in their lane, but I want them at random times and random player not knowing if they are coming from left or right. 6,516 Rep Post Options    Quote  Reply Posted: 07 Mar 2012 at 7:08am Maybe this:---Global "random"Every tick: set random to rand(20)Compare values: tickcount%5 = random-> Create "Car" at ((rand(3)%2) * 100, rand(6)*10)---I guess this is a simple way of randomizing time... if you change rand(20) to something higher, it will be less likely to happen(rand(3)%2) * 100 will create the car either at left or rightrand(6)*10 is to create the car randomly at 7 different Y positions with 10 pixels between them

 Forum Jump -- Select Forum --  Arcade  Construct 2 general  How do I....?  Your Creations  Education  Bugs   - Closed bugs  Plugins for Construct 2  Javascript SDK development  Open Topic  General game design  Tools/resources  Website issues  Help Wanted  Construct Classic Discussion   - Help & Support using Construct Classic   - Your tutorials & example files   - Your Creations   - Completed addons   - Work-in-progress addons   - Construct engineering Forum Permissions You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot delete your posts in this forumYou cannot edit your posts in this forumYou cannot create polls in this forumYou cannot vote in polls in this forum