Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (753)
Games in Android Showcase (228)
games submitted by our members
Games in WIP (842)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 3 4 [5] 6 7 ... 10
 41 
 on: 2018-04-18 15:11:18 
Started by nelsongames - Last post by Damocles
A good overview is here:

https://github.com/SilverTiger/lwjgl3-tutorial/wiki/Game-loops

this is a gameloop with a fixed logic-timestep
and a variable render timestep:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public void gameLoop() {
    float delta;
    float accumulator = 0f;
    float interval = 1f / targetUPS;
    float alpha;

    while (running) {
        delta = timer.getDelta(); //eg: = timeNow - timeLastCall
        accumulator += delta;

        input();

        while (accumulator >= interval) {
            update();
            accumulator -= interval;
        }

        alpha = accumulator / interval; // between 0 and 1, used to smooth animations and movement
        render(alpha);  

        window.update();
    }
}


It has the advantage of frame rate independent constant-time logic updates, while allowing frames to draw as fast as the client can do it.
Constant-time logic ticks are way easier to program, and avoid edge cases when the framerate drops too low or runs too fast.

 42 
 on: 2018-04-18 12:08:10 
Started by Vierarmig - Last post by Vierarmig
Skate Hooligans - Amusement Park


 43 
 on: 2018-04-17 18:58:55 
Started by ByerN - Last post by ByerN
Added local objectives (video Smiley)

 44 
 on: 2018-04-17 12:24:28 
Started by Springrbua - Last post by Springrbua
Just released Version 0.4.0 with a new Discipline:

High Jump

Run by smashing the [momentum]-button as fast as you can and hold [jump] to increase the jump angle.
Release the [jump]-button to jump and press it again, to start the back-rotation.
The goal is it to jump over the bar.
The height of this bar can be set after every successful try, you have 3 tries/height.
The winner is the one who cleared the highest height. In case of a tie, the one with less tries in the previous height wins.
If there is still a draw, the one with less failures wins.


Note:
This is the first version of the high jump and it is not yet completed. The view does not exactly represent the logic and therefore some successful tries count as fail and vice versa.
Also there are stil a few textures missing and some parameters (like speed) need to be adjusted.

The versions for desktop, android and html are all on my google drive, the link is in the start post.
Any feedback is very welcome Smiley

 45 
 on: 2018-04-17 09:04:48 
Started by Zemlaynin - Last post by Zemlaynin
I added two urban district - industrial and administrative:


Now the buildings can be rotated:

 46 
 on: 2018-04-17 00:51:50 
Started by nelsongames - Last post by fenaryh
I recommend these two links to a better understand for games in general:

http://gameprogrammingpatterns.com/game-loop.html
http://gameprogrammingpatterns.com/update-method.html

And also recommend this whole book, lol

Regards

 47 
 on: 2018-04-17 00:49:35 
Started by nelsongames - Last post by fenaryh
There are two books that can help you, but I think there are a lot of videos and etc in Youtube.

Learning LibGDX Game Development (it uses a cross-platform game all the book)
Mastering LibGDX Game Development (it uses a rpg game)

You can also look that series, I will certainly help:
http://www.gamefromscratch.com/page/LibGDX-Tutorial-series.aspx

Regards,

 48 
 on: 2018-04-16 20:06:47 
Started by nelsongames - Last post by nelsongames
What are some really good books or video's / tutorials on LibGDX? Tried going through the one on PluralSight and there was nothing technical, just a lot of bad jokes.

 49 
 on: 2018-04-16 19:52:44 
Started by fenaryh - Last post by fenaryh
So, I finally figure out a solution. First, not using a Texture. Now I'm using a TextureMapObject. That way, is a must to create a MapObjectLayer also in Tiled.

Include the batch.setProjectionMatrix(camera.combined) before batch.begin().

And also draw manually using batch.draw(). It follows the final code for anyone struggling:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
public class TiledTest extends ApplicationAdapter {
   
    private static final String TAG = TiledTest.class.getName();
   
    TextureMapObject tmo;
    TiledMap tiledMap;    
    OrthographicCamera camera;    
    TiledMapRenderer tiledMapRenderer;
    SpriteBatch batch;    
    Texture texture;
    Actor actor;
    Stage stage;

   
   
    @Override
    public void create () {
        float w = Gdx.graphics.getWidth();
        float h = Gdx.graphics.getHeight();
       
        batch = new SpriteBatch();
        camera = new OrthographicCamera();
       
        camera.setToOrtho(false,w,h);
        camera.update();        
       
       
        InternalFileHandleResolver handle = new InternalFileHandleResolver();
        handle.resolve("mapa_teste.tmx");
        TmxMapLoader loader = new TmxMapLoader(handle);        
        tiledMap = loader.load("img/mapas/mapa_teste.tmx");
       
        tiledMapRenderer = new OrthogonalTiledMapRenderer(tiledMap);
       
        //TextureMapObject
        texture = new Texture(Gdx.files.internal("img/tanque_192x192.png"));
        tmo = new TextureMapObject(new TextureRegion(texture,192,192));
        tmo.setX(128);
        tmo.setY(128);
        tiledMap.getLayers().get("Objects").getObjects().add(tmo);
        stage = new Stage();
        actor = new Actor();
        actor.setBounds(128,128, tmo.getTextureRegion().getRegionWidth(), tmo.getTextureRegion().getRegionHeight());
        actor.addListener(new ClickListener(){
            @Override
            public void clicked(InputEvent event, float x, float y) {
                super.clicked(event, x, y);
                Gdx.app.log(TAG, "Tanque clicado!");
            }

            @Override
            public void exit(InputEvent event, float x, float y, int pointer, Actor toActor) {
                super.exit(event, x, y, pointer, toActor);
                if(pointer == -1)
                    Gdx.app.log(TAG, "Mouse saindo do actor!");                
            }

            @Override
            public void enter(InputEvent event, float x, float y, int pointer, Actor fromActor) {
                super.enter(event, x, y, pointer, fromActor);
                if(pointer == -1)
                    Gdx.app.log(TAG, "Mouse entrando no actor!");                
            }
                     
        });
        stage.addActor(actor);                
        Gdx.input.setInputProcessor(stage);
        stage.getViewport().setCamera(camera);
        stage.setDebugAll(true);        

       
    }

    @Override
    public void render () {

        input();
       
        Gdx.gl.glClearColor(0, 0.5f, 0.5f, 1);
        Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        camera.update();
        tiledMapRenderer.setView(camera);
        tiledMapRenderer.render();
       
        batch.setProjectionMatrix(camera.combined);
        batch.begin();        
       
        batch.draw(tmo.getTextureRegion(), tmo.getX(), tmo.getY(),
                tmo.getOriginX(), tmo.getOriginY(), tmo.getTextureRegion().getRegionWidth(), tmo.getTextureRegion().getRegionHeight(),
                tmo.getScaleX(), tmo.getScaleY(), tmo.getRotation());      
       
        batch.end();
       
       
        stage.act();
        stage.draw();        


    }

   
    public void input(){
       
        float cameraSpeed = 7f;
       
        if(Gdx.input.isKeyPressed(Input.Keys.S)){
            camera.translate(0f, +cameraSpeed);            
        }
        if(Gdx.input.isKeyPressed(Input.Keys.W)){
            camera.translate(0f, -cameraSpeed);                        
        }
        if(Gdx.input.isKeyPressed(Input.Keys.A)){
            camera.translate(-cameraSpeed, 0f);                        
        }
        if(Gdx.input.isKeyPressed(Input.Keys.D)){
            camera.translate(+cameraSpeed, 0f);                        
        }
        if(Gdx.input.isKeyPressed(Input.Keys.F2)){
            camera.zoom += 0.01f;
        }if(Gdx.input.isKeyPressed(Input.Keys.F3)){
            camera.zoom -= 0.01f;
        }
        if(Gdx.input.isKeyJustPressed(Input.Keys.ESCAPE)){
            stage.dispose();
            batch.dispose();
            tiledMap.dispose();            
            Gdx.app.exit();
        }
       
    }
   
}

 50 
 on: 2018-04-16 06:27:02 
Started by Zemlaynin - Last post by Zemlaynin
Evolution of the user interface














































Pages: 1 ... 3 4 [5] 6 7 ... 10
 
ivj94 (583 views)
2018-03-24 14:47:39

ivj94 (48 views)
2018-03-24 14:46:31

ivj94 (374 views)
2018-03-24 14:43:53

Solater (62 views)
2018-03-17 05:04:08

nelsongames (109 views)
2018-03-05 17:56:34

Gornova (151 views)
2018-03-02 22:15:33

buddyBro (693 views)
2018-02-28 16:59:18

buddyBro (92 views)
2018-02-28 16:45:17

xxMrPHDxx (493 views)
2017-12-31 17:17:51

xxMrPHDxx (733 views)
2017-12-31 17:15:51
Java Gaming Resources
by philfrei
2017-12-05 19:38:37

Java Gaming Resources
by philfrei
2017-12-05 19:37:39

Java Gaming Resources
by philfrei
2017-12-05 19:36:10

Java Gaming Resources
by philfrei
2017-12-05 19:33:10

List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05
java-gaming.org 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‑gaming.org
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!