Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (575)
Games in Android Showcase (154)
games submitted by our members
Games in WIP (623)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 7 8 [9] 10
 81 
 on: 2015-04-25 00:17:42 
Started by MrPork - Last post by MrPork
    I've been wondering on how I could make zooming in my space game less boring and then it hit me. How would I recreate a sort of Hyper Speed effect while im zooming in and manage to move stars in a smooth fashion while doing this? Would I have multiple layers of images that act as sort of a hud display and are relative to the camera? Or would I generate a massive amount of small textures of stars across my world and somehow create an effect that way? I'm neither a good programmer nor a good art designer, but I'm slowly making progress at least and am trying to soak up as much as I can in both areas. Have any of you guys tried doing this before? I searched around google and found "Parallax backgrounds" but all I found were sides-crollers instead of top down RTS games.  Thank you!  Grin

Edit: Something like this, except zooming capabilities. https://www.youtube.com/watch?v=mUrJukqyhIE

 82 
 on: 2015-04-25 00:03:54 
Started by Andre Lopes - Last post by BurntPizza
Some languages simply have it explicit.

It seems weird when you're used to an implicit 'this' pointer, but if you think about it, a magical invisible 1st-argument-to-every-function-on-an-instance is a bit weird too.
But then python (and others) are a little inconsistent (albeit for ergonomic purposes) by having the call syntax as instance.function(args) instead of function(instance, args) a la C.

 83 
 on: 2015-04-24 23:57:37 
Started by Andre Lopes - Last post by Andre Lopes
http://www.tutorialspoint.com/python/python_classes_objects.htm

self is called this in java, where it is normally an implicit argument, but is explicit in method declarations in python.

http://stackoverflow.com/questions/419163/what-does-if-name-main-do

if __name__ == '__main__': is querying the interpreter if this file is being run as the main program.
Basically a public static void main in java, but more of a question than a statement.

Hm, i see.
And well, why is "self" required? it doesnt make sense to me '-'

 84 
 on: 2015-04-24 22:26:05 
Started by syszee - Last post by syszee
Thank you both. I've been reading, I was just/am more or less confused on the next step, after adding all closed paths to the closed array. I've just implemented a cost system for the tiles that I think MAY work, but I could be totally wrong.

Inside of the tile class
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
   public int getPathCost(int tx, int ty, int sx, int sy){
     
      Vector2 target = new Vector2();
      Vector2 start = new Vector2();
      start.set(sx, sy);
      target.set(tx, ty);
     
      int hx = (int)(target.x - position.x);
      int hy = (int)(target.y - position.y);
     
      int h = hx + hy;
      int g;
     
      if((start.x + 1) == position.x && (start.y) == position.y) g = 10;
      else if((start.x - 1) == position.x && (start.y) == position.y) g = 10;
      else if((start.x) == position.x && (start.y + 1) == position.y) g = 10;
      else if((start.x) == position.x && (start.y - 1) == position.y) g = 10;
      else g = 14;
     
      return h + g;
     
   }


From here, I don't quite understand how to continue as the guide says. Any pointers would be great!

Also, here is an example of what I have now.
http://i.imgur.com/4N3RBWn.gif

So, I've got it checking each spot and determining whether it should be closed or open. & I've got a cost method that is not yet being decided. I just don't really know where to go from here.

 85 
 on: 2015-04-24 21:04:29 
Started by Andre Lopes - Last post by BurntPizza
http://www.tutorialspoint.com/python/python_classes_objects.htm

self is called this in java, where it is normally an implicit argument, but is explicit in method declarations in python.

http://stackoverflow.com/questions/419163/what-does-if-name-main-do

if __name__ == '__main__': is querying the interpreter if this file is being run as the main program.
Basically a public static void main in java, but more of a question than a statement.

 86 
 on: 2015-04-24 20:55:40 
Started by Andre Lopes - Last post by Andre Lopes
Hi forum! i didnt know where to post in this forum, so well.. i posted here.

Can anyone help me with a few questions on python?
Im studying with a book, but the book doesnt explain a few things.. Since im a java programmer, im obviously trying to see the differences between the two languages and i know python can be procedural language too... Anyway, can anyone help me with this simple code?


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  
class Application():

    #THis is the constructor?
    #Why it receives self?
    def __init__(self):
        print "__init__"

    #Why it receives self?
    def printText(self, text):
        print text


class Example():
    def run(self):
        print "Hello, world!"





a = Application()
#Why i dont need to pass, 'a" as a first parameter
a.printText("Hi World")


# i Dont get this :
if __name__ == '
__main__':
    Example().run()

 87 
 on: 2015-04-24 20:52:35 
Started by thedanisaur - Last post by KaiHH
Just one note:
You might want to also have a look at Uniform Buffer Object.
Those could be more up to the task when it comes to feeding structured data to your shader, since they allow for aggregate data types, such as vec4 and mat4 directly in them and you therefore do not need a custom texture lookup function to build matrices from texel samples.
You also do not need a backing texture and sampler, just a Buffer Object.

UBOs however need a defined static (max.) size in the shader.
So if you know you are going to have at max 256 objects, you can use the following:

1  
2  
3  
4  
5  
6  
7  
8  
9  
#define MAX_OBJECTS 256
struct Object {
  mat4 modelviewMatrix;
  mat4 projectionMatrix;
  mat4 normalMatrix;
}
layout (std140) uniform Objects {
  Object objects[MAX_OBJECTS];
}


The layout with std140 in memory (in the Buffer Object) on your Java side in this particular case is column-major, tight packing without any padding.
And to retrieve the modelview matrix (for example), you can just use:
1  
objects[theIndex].modelviewMatrix


MAX_OBJECTS is also just an upper bound on the maximum number of objects that can be contained in the UBO. You can always glBufferData just a subset of the data to the Buffer Object and access that subset in the shader.

 88 
 on: 2015-04-24 19:05:50 
Started by syszee - Last post by DavidBVal
Really there's no shortcut to a good implementation of A*, and although you can reuse some code from other people, as your game map is unique, likely you'll have to write 90% of it yourself, in full understanding of what you're doing. Do as Sabomoth said, make sure you understand what the algorithm does, and come back for specific questions if you don't understand a paragraph or concept in particular. Then you'll be able to take someone else's A* code and make it work for your game.

 89 
 on: 2015-04-24 18:44:36 
Started by thedanisaur - Last post by thedanisaur
Yeah after Riven posted I looked into it and it's exactly what I want. Thanks guys!

Edit: I just realized I posted this on the wrong board, sorry about that

 90 
 on: 2015-04-24 16:49:34 
Started by Lucasmontec - Last post by Riven
I'm a bit late to the party... but if you see a trail, you're either drawing more and more sprites per frame (from oldest position to newest position, rendered on top of eachother), or you are not clearing your frame buffer each frame, or your geometry is much larger than your sprite and the texture is configured to clamp-to-edge..

Pages: 1 ... 7 8 [9] 10
 
BurntPizza (29 views)
2015-04-23 03:42:11

theagentd (34 views)
2015-04-22 16:23:07

Riven (48 views)
2015-04-16 10:48:47

Duke0200 (59 views)
2015-04-16 01:59:01

Fairy Tailz (41 views)
2015-04-14 20:13:12

Riven (43 views)
2015-04-12 21:36:37

bus hotdog (60 views)
2015-04-10 02:39:32

CopyableCougar4 (66 views)
2015-04-10 00:51:04

BurntPizza (69 views)
2015-04-06 22:06:58

ags1 (67 views)
2015-04-02 10:58:48
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27
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!