How do I constantly scroll?

Get help using Construct 2

Post » Mon Jun 30, 2014 11:45 am

Hi everyone,

I guess this is more of a 'what's the best way' rather than 'How Do I' but here goes:

I have a platformer style set-up except my character constantly moves forward (like flappy birds for example).

Whats the best way to keep the character in the centre of the screen? I'm currently using 'Scroll to' on the player object - but it seems to produce some stuttery effects as the screen moves (not lag - everything else is smooth). Is this really the best way?

Thanks!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Mon Jun 30, 2014 12:20 pm

I would keep the player in the middle and move the entire background / objects to the left.
This way you don't need ScrollTo.
B
6
S
1
Posts: 73
Reputation: 571

Post » Mon Jun 30, 2014 12:28 pm

rezagamertag wrote:I would keep the player in the middle and move the entire background / objects to the left.
This way you don't need ScrollTo.


Hi Rezagamertag,

Interesting! Why would you take that route - I must be wrong in thinking moving many objects is more CPU intensive than just moving one?

Thanks for your input!
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Mon Jun 30, 2014 1:27 pm

It saves time creating very large maps, especially when it's an easy game like Flappy Bird where repeated objects appear constantly.
The pipes appear at a random position on the right side and the background is a repeating pattern.
All you have to do is move the bird up and down and you've got yourself an award winning game.
B
6
S
1
Posts: 73
Reputation: 571

Post » Mon Jun 30, 2014 1:32 pm

Is there any other reason other than CPU use for you to use ScrollTo? Are there some special events that need this?

I have to agree with rezagamertag above. As you rightly say moving many objects is more CPU intensive than just moving one, but I'd say in most cases doing it this way will save a lot of headaches in the long run over using the 'ScrollTo' action. Just don't forget to terminate objects that fly off the side of the screen.
Intermediate level Construct 2 developer, looking to build up my portfolio : https://seriouslycrunchy.itch.io/

Current projects : Bite Sized Game Development, please have a look at my tutorials and comment!

I also write for http://moonbooks.net/, please come and check us out!

Follow me on twitter! @SrslyCrunchy I'm always looking for games or templates to highlight, use the hashtag #madeinconstruct !
B
15
S
7
Posts: 52
Reputation: 3,126

Post » Mon Jun 30, 2014 2:19 pm

SeriouslyCrunchy wrote:Is there any other reason other than CPU use for you to use ScrollTo? Are there some special events that need this?

I have to agree with rezagamertag above. As you rightly say moving many objects is more CPU intensive than just moving one, but I'd say in most cases doing it this way will save a lot of headaches in the long run over using the 'ScrollTo' action. Just don't forget to terminate objects that fly off the side of the screen.


Hi SeriouslyCrunchy,

Nope, I was using 'ScrollTo' because I thought it was the 'best' was of doing things. It just keeps the camera focused on the player object as it travels through the levels, that all.

By best I generally mean best for performance; as the game is on mobile devices performance can be an issue!

Although I did make flappy bird comparisons only the movement is really the same - things get much more complicated after that - levels are certainly much more diverse.

I'm guessing there is a tipping point somewhere; where the size/complexity of the level eventually makes it so the 'ScrollTo' behaviour is the best way forwards?

Thanks
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Mon Jun 30, 2014 4:47 pm

Your game sounds less 'flappy bird' and more 'infinite runner', although flappy bird is of course an infinite runner in itself in a way, so some of the same principles hold true. Have you had a look at the infinite runner example in C2? I also wrote a small tutorial about infinite runners, but I don't think this covers what we're discussing right now.

I'd like to see a .capx if possible of your attempt with ScrollTo. In my experience, the issue with using ScrollTo for infinite runners is that it in my opinion it gives you less control over certain aspects of the game. Object instance generation and termination are much easier to handle, for example.
Intermediate level Construct 2 developer, looking to build up my portfolio : https://seriouslycrunchy.itch.io/

Current projects : Bite Sized Game Development, please have a look at my tutorials and comment!

I also write for http://moonbooks.net/, please come and check us out!

Follow me on twitter! @SrslyCrunchy I'm always looking for games or templates to highlight, use the hashtag #madeinconstruct !
B
15
S
7
Posts: 52
Reputation: 3,126

Post » Tue Jul 01, 2014 7:53 am

SeriouslyCrunchy wrote:Your game sounds less 'flappy bird' and more 'infinite runner', although flappy bird is of course an infinite runner in itself in a way, so some of the same principles hold true. Have you had a look at the infinite runner example in C2? I also wrote a small tutorial about infinite runners, but I don't think this covers what we're discussing right now.

I'd like to see a .capx if possible of your attempt with ScrollTo. In my experience, the issue with using ScrollTo for infinite runners is that it in my opinion it gives you less control over certain aspects of the game. Object instance generation and termination are much easier to handle, for example.


Hi SeriouslyCrunchy,

I have to admit, I haven't actually looked at the infinite runner example - although I just had a look for it now in the example projects and couldn't find it at all? Do you know what it's called?

Would you link me to your tutorial? Any and all opportunities to learn are always welcome even if it is not 100% applicable here!

Unfortunately I cant upload my capx - but I can describe to you EXACTLY how my ScrollTo works.

My ScrollTo behaviour is implemented on my player object (by just adding the behaviour from the behaviour panel).

My player object then moves forwards like so:

PlayerObject| Set X to Self.X + 240 *dt.

My levels are pretty long (14,000 px horizontal) but not infinite and have a variety of different objects within them!

Am I doing this the best way?
B
13
S
6
Posts: 130
Reputation: 1,553

Post » Tue Jul 01, 2014 10:12 am

infinite runner not example but it's template here it is
You do not have the required permissions to view the files attached to this post.
B
257
S
42
G
15
Posts: 1,991
Reputation: 41,411

Post » Tue Jul 01, 2014 11:59 am

Lordshiva1948 wrote:infinite runner not example but it's template here it is


Apologies, you're quite right its a template.

@TMAJA ,

My tutorial on ways of extending the above infinite runner template is here : https://www.scirra.com/tutorials/1019/bite-sized-game-development-adding-complexity-to-infinite-runners

There is a good idea behind your method, usually in an infinite runner you either generate the objects after a certain time and at a certain position, sometimes randomly, but you're building the entire level right at the start and not generating it on the fly so I'm going to assume you want your objects to be always fixed in the same place every time the level is played.

The bigger issue for me is if you have a pretty large level, there are going to be a lot of objects in the layout, that aren't visible on screen, but will still be impacting performance.

I need to head out for an hour but this little discussion interests me so I'll come back and expand on it further, even if you don't require any more help.
Intermediate level Construct 2 developer, looking to build up my portfolio : https://seriouslycrunchy.itch.io/

Current projects : Bite Sized Game Development, please have a look at my tutorials and comment!

I also write for http://moonbooks.net/, please come and check us out!

Follow me on twitter! @SrslyCrunchy I'm always looking for games or templates to highlight, use the hashtag #madeinconstruct !
B
15
S
7
Posts: 52
Reputation: 3,126

Next

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 7 guests