Horizontal scrolling dodging game

Get help using Construct 2

Post » Thu Nov 06, 2014 12:41 am

Hello guys!

So here's the thing, I'm working on a new game concept based on the Auto-Runner base.

I'm including the .CAPX for more lisibility and making myself clear because my problems are quite complicated to explain.
The .CAPX can be found here: http://dl.free.fr/iRgRCD0HL


I used the Auto runner base because I want to make a horizontal dodging game.
I don't need the block platform, but I used the set-up of it to base my random incoming obstacle events on. :geek:

Just imagine a top view of a freeway, and the goal is to dodge the cars that comes at you.
The player isn't moving, it's the background that simulate the speed. Just like in the Auto-Runner game. And of course the game generate obstacles in those 3 lanes, so you actually have to dodge switching from one lane to the other pressing up and down.

Gameplay:

Lane 01---------------------------------------------------
Lane 02---------( player )-------------<-<-<---[////] incoming obstacle
Lane 03---------------------------------------------------


Lane 01---------( player )------------------------------ obstacle dodged
Lane 02-------<-<-<---[///]-----------------------------
Lane 03----------------------------------------------------



So the goal is to avoid the most obstacle before getting hit and being destroyed. Simple :)
The time you spend avoiding collision is pretty much your score.

My problems are the followings:

1- How can I make sure that there will always be a way to dodge. How can I configure an event that say that if 3 obstacles are on the same X segment upon creation he has to destroy one of them to give the player a chance to dodge them.
I would like to have some kind of a randomized creation system, so the player won't find a pattern to pass trough the game.
That's why I don't want to do a System-Every X seconds// System-create Obstacle on lane 1. ;)

2- I would like my player to be on a rail ( Player.X being always the same), so how can create an event that will add Y+30 (Just random number to make my point) when he push up, and Y-30 when he push down. Just basically switching from one of one lane to the upper or lower one. Maybe there is a better way to do that...

Thanks you very much for the help! :)
B
7
S
1
Posts: 31
Reputation: 689

Post » Thu Nov 06, 2014 1:46 am

Here is a tutorial I did for a vertical game idea much like you suggest. I know its very basic, is vertical, and uses the random spawn you don't want but it may give you some ideas.
https://www.scirra.com/tutorials/1202/very-basic-top-down-vertical-driving-game-capx-tutorial

I don't see what you have against the random spawning of items in the lane the whole fun of avoiding is the possibility of an impossible combo. :)
You could always have an invisible sprite covering all 3 lanes with the condition if more than one of each lanes sprites are overlapping it at once it chooses a random one and deletes it...

The lane change thing is easy if your player can't move forward or back.. just have an invisible sprite in all 3 locations and tween or move/snap the player to the one above, below as chosen.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Thu Nov 06, 2014 4:36 am

Thanks!

Yeah I like the idea of the spawners, that would totally help me in the random spawning process. I didn't knew the choose command. that's some great help!

But you see, if you drive your car to the complete left or right, then you'll never encounter an obstacle. I will need to find something to avoid that. Maybe add some random stopped obstacles on the side of the road. Like cones or whatever.

Can you explain me how the System-Every random(2,8) action work? That it mean that the car is created randomly between 0 and 2,8 sec?

I would also like to understand what is the purpose of the line System-trigger once after the spawning? Does it prevent to generate the action twice while the car is still on the layout or not destructed yet?

Great work by the way!
B
7
S
1
Posts: 31
Reputation: 689

Post » Thu Nov 06, 2014 7:53 am

Here's a version with 'slightly' less events. 72 down to 25 :) and that's without tackling the player car crashing events. Enjoy.

(I did this because of what you said in the tutorial)
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Thu Nov 06, 2014 1:07 pm

(I did this because of what you said in the tutorial)

Thanks Codah, I am always looking for more efficient ways to do things. Coding has never been a strong suit of mine so many of the tricks evade me.
I am more the shade tree mechanic getting the car running with duct tape and JB weld.

But you see, if you drive your car to the complete left or right, then you'll never encounter an obstacle. I will need to find something to avoid that. Maybe add some random stopped obstacles on the side of the road. Like cones or whatever.

I just threw this together for someone as an example, didn't tweak the gameplay, if you narrowed the road a little it would eliminate this issue.

Can you explain me how the System-Every random(2,8) action work? That it mean that the car is created randomly between 0 and 2,8 sec?

It creates a car every 2 to 8 seconds.

I would also like to understand what is the purpose of the line System-trigger once after the spawning? Does it prevent to generate the action twice while the car is still on the layout or not destructed yet?


I am not sure why I used it there without looking at my event but anytime you have an event where the conditions are not specifically triggered once (aka collision) then you need to trigger it once or else it will be run 60x a second (each tick) per iteration until the conditions are no longer satisfied. Example would be an object overlapping condition where you move one object away if it overlaps another it may run through several passes before moving away since it detects overlapping for a duration... by triggering it once it stops after firing off one time until it detects a new triggering of that events conditions.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
68
S
17
G
8
Posts: 637
Reputation: 9,420

Post » Thu Nov 06, 2014 11:38 pm

chrisinfinger wrote:
I would also like to understand what is the purpose of the line System-trigger once after the spawning? Does it prevent to generate the action twice while the car is still on the layout or not destructed yet?


I am not sure why I used it there without looking at my event but anytime you have an event where the conditions are not specifically triggered once (aka collision) then you need to trigger it once or else it will be run 60x a second (each tick)


Yes these are definitely needed for performance reasons. Somehow 3 of them got lost in my mods, but there should be one after each of these 3 lines
TreeSpawners: SpawnerTreeType /= 0
ObstacleSpawners: SpawnerObstacleType /= 0
CarSpawners: SpawnerCarType /= 0


Still, no extra events :)

Edit: here it is
TopDownCarTutorial_codah_modified.capx


Edit 2: hm for some reason that stops the cars and trees from appearing, but I don't have time to look at it right now. Exercise for the reader!
You do not have the required permissions to view the files attached to this post.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Wed Dec 02, 2015 11:12 pm

Thanks
B
6
Posts: 43
Reputation: 342


Return to How do I....?

Who is online

Users browsing this forum: brunopalermo, busydude and 33 guests