Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (780)
Games in Android Showcase (233)
games submitted by our members
Games in WIP (857)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  LibGDX - Scrolling Texture Y-Axis  (Read 1620 times)
0 Members and 1 Guest are viewing this topic.
Offline syszee
« Posted 2014-10-02 01:55:38 »

Hi there,

I'm looking for the simplest way to scroll a texture downward with repeat on the Y-Axis. (For example, rain constantly repeating)
(Full examples please)

- A

Offline LiquidNitrogen
« Reply #1 - Posted 2014-10-02 03:49:00 »

I would say the simplest way is to draw it twice, one above the other, both constantly moving downward. once the first one is just off the bottom of the screen, make them both jump back to the top.
Offline basil_

« JGO Bitwise Duke »

Medals: 418
Exp: 13 years

« Reply #2 - Posted 2014-10-02 08:17:10 »

with opengl you could use the texture state :

repeat Y coord :
, then just increment along Y.

ofc you could also use a fragment shader.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Rayexar
« Reply #3 - Posted 2014-10-02 09:09:10 »

I did this recently:

Render one image at y-position 0, and another at y-position Every frame, for each texture, subtract an amount, scrollRate* from the y-pos of each texture. Every frame, check whether the y-position of the bottom texture is equal to or less than -(negative) screenHeight , and if so, set it equal to screenHeight.
Offline Norakomi
« Reply #4 - Posted 2014-10-02 09:36:11 »

additionally: You can also use just one Texture. If your texture has repeating patterns of say 20px for example. You could create a texture with height equal to the screenheight and add one of those patterns on top. Have the texture start at y=0 and move it down and when it reaches y=-20 start over again.

You can also use multiple textures and give them different scroll speeds which can give a cool effect.

Okay I'm not a fan of self promotion, but here is an example from a game I'm working and where i used the above described method on and though i post it here. Maybe it'll give you some extra ideas.

At 0:30

Pages: [1]
  ignore  |  Print  

hadezbladez (745 views)
2018-11-16 13:46:03

hadezbladez (386 views)
2018-11-16 13:41:33

hadezbladez (736 views)
2018-11-16 13:35:35

hadezbladez (194 views)
2018-11-16 13:32:03

EgonOlsen (2394 views)
2018-06-10 19:43:48

EgonOlsen (2557 views)
2018-06-10 19:43:44

EgonOlsen (1482 views)
2018-06-10 19:43:20

DesertCoockie (2145 views)
2018-05-13 18:23:11

nelsongames (1949 views)
2018-04-24 18:15:36

nelsongames (2629 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!