# How do I create infinity hills?

Get help using Construct 2

### » Sat Oct 03, 2015 12:50 am

I want to create "Hill Climb Racing" like game, How do I create infinity hills?
I want to create hills like below image.

B
3
Posts: 3
Reputation: 181

### » Sat Oct 03, 2015 6:35 pm

What have you tried so far?

Minus the graphics, can you make that slope there with collisions?
One way often used is to use multiple sprites to define the slope. So say you have a circle sprite you could place them in a row on the grass level. More advanced ideas would be to stretch a rectangle sprite from circle to circle to make the surface smoother.

Anyway, to make the slope continue you just add sprites to the right of the last sprite.
In the simplest case you can do this:

Global x=0
Global y=0

While
compare: x < screenleft
--- set y to 100*sin(x)+320
--- create sprite at x,y

The "set y" expression is how your slope is defined, and you can do anything with it. Some examples:
100*sin(x)+320 is just a sine wave
100*sin(x)+50*sin(x*3+22)+320 is two sine wave combined to make a varied slope.
(noisejs.perlin2(x*0.44, 0.5)+1)*100+320 uses the noise plugin to use perlin noise.

Noise plugin:
viewtopic.php?t=93998&start=0
terrain examples:
viewtopic.php?f=147&t=120451&p=862291&hilit=terrain#p862291
B
98
S
36
G
132
Posts: 5,525
Reputation: 84,013

### » Sun Oct 04, 2015 12:16 am

@R0J0hound : Thank You very much!
B
3
Posts: 3
Reputation: 181