Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (515)
Games in Android Showcase (122)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 5 6 [7] 8 9 10
 61 
 on: 2014-10-29 22:29:27 
Started by BurntPizza - Last post by kevglass
Random prototype/concept picture for a mobile game:



Cheers,

Kev

 62 
 on: 2014-10-29 21:52:11 
Started by BurntPizza - Last post by Riven
You're asking me to make a dozen tutorials, hoping one of them matches your needs? Smiley

If you show me some code, I most likely can spot the misconception in a few minutes.

 63 
 on: 2014-10-29 21:50:29 
Started by BurntPizza - Last post by basil_
speaking of mystery .. i'm still banging my head agains LibStruct trying to get the raytracer to fly with it. any chance you share some tutorials ?

 64 
 on: 2014-10-29 21:11:30 
Started by JJengineering - Last post by JJengineering
Having nodes and wires as separate things also enables easy "wireless" game mechanics, i.e. a node over here can send power/etc to a node across the room. In game this may be a "wireless network," a "force field," or simply programming convenience, as the "wire" can simply be part of the background/tile image.

Thats right, but I want to implement it in a way, where the whole network is visible, since the game mechanics are based on a destroyed eletricity network.
In fact when i started i wanted to do it wireless, but as i carved out my game mechanics, it was clear to me that i need some kind of electricity that runs over tiles, that are visible and immediately identifiable. (as in Prison Architecht, you look at the 'electro layer', and can see relatively fast whats wrong)

I love that.

 65 
 on: 2014-10-29 21:06:01 
Started by JJengineering - Last post by BurntPizza
Having nodes and wires as separate things also enables easy "wireless" game mechanics, i.e. a node over here can send power/etc to a node across the room. In game this may be a "wireless network," a "force field," or simply programming convenience, as the "wire" can simply be part of the background/tile image.

 66 
 on: 2014-10-29 21:03:01 
Started by JJengineering - Last post by JJengineering
It sounds like you want each tile to be/have a node, and have wires connecting adjacent tiles.

It seems to be the simplest thing, and as Riven pointed out, that a 'Wire' is best used in the way he explains it, becomes now clear to me.
It seems so obvious now Tongue

Sorry i misread you post, no i dont want to connect adjacent tiles, at least for now, but with this techniques that would be easy Tongue

 67 
 on: 2014-10-29 20:59:37 
Started by JJengineering - Last post by BurntPizza
It sounds like you want each tile to be/have a node, and have wires connecting adjacent tiles.

 68 
 on: 2014-10-29 20:57:47 
Started by JJengineering - Last post by JJengineering
Quote
Every Wire is passed to exactly two Nodes, not more.

I might not have it 100% down on the conceptual level, but if i have a tile that leads the electricity from one tile, to the three neighbour tiles (Left -> Up/Down/Right), then i could make a 'CrossConnection Node', that has 4 wires, each referenced to the 'CrossConnection Node' and the other node it is connected to, would that be the right interpretation of the concept?




 69 
 on: 2014-10-29 20:31:10 
Started by AndroidAddict - Last post by JJengineering
Hi AndroidAddict :)

For the collision detection in tile based games you have a few options depending on how fast you want to make it.

Note: i suppose you are using a two dimensional array for the tile map, that way it is much easier to get the right tile simply by knowing the coordinates of the tile in tile coordinates ((int)(ScreenPosition/tileSize))

Method A:
1) Create an array in the class where you run you collision code (should not be a local variable, but an instance variable)
2) Before checking collisions, get every tile around marion by tile coordinates (this works good with objects that are, at best just a little smaller than a tile)
    Then you add the tiles around mario to the array, by getting them mathematically, based on marios center position.
1  
2  
3  
4  
5  
6  
7  
8  
collisionArray.add(tilemap.getTile(mario.tilePositionX-1, mario.tilePositionY-1)); /*Bottom Left*/
collisionArray.add(tilemap.getTile(mario.tilePositionX, mario.tilePositionY-1)); /*Bottom Center*/
collisionArray.add(tilemap.getTile(mario.tilePositionX+1, mario.tilePositionY-1)); /*Bottom Right*/
collisionArray.add(tilemap.getTile(mario.tilePositionX-1, mario.tilePositionY)); /*Center Left*/
collisionArray.add(tilemap.getTile(mario.tilePositionX+1, mario.tilePositionY)); /*Center Right*/
collisionArray.add(tilemap.getTile(mario.tilePositionX-1, mario.tilePositionY+1)); /*Top Left*/
collisionArray.add(tilemap.getTile(mario.tilePositionX, mario.tilePositionY+1)); /*Top Center*/
collisionArray.add(tilemap.getTile(mario.tilePositionX+1, mario.tilePositionY+1)); /*Top Right*/

3) iterate the collision array and check collision against the saved tiles + check if is collideable etc.
4) remove all the added tiles (empty out the collision array)
5) do it again

Method B:
Get a certain region of tiles from the tile map based on marios center position.
You can loop through the tile map for this, with an offset to the left, right, top, bottom, to make sure there are always tiles in the collision array that mario collides with.

1  
2  
3  
4  
5  
for(int y = 0; y < collisionChunkHeight; y++){
     for(int x = 0; x < collisionChunkWidth; x++){
          collisionArray.add(tilemap.getTile.((mario.tilePositionX-collisionChunkWidth)+x, (mario.tilePositionY-collisionChunkHeight)+y));
     }
}


And then you have a region of tiles that are around mario, that you can then check the collision against.

There are a few more, in case, but i guess these are pretty simple and performant enough.



 70 
 on: 2014-10-29 20:26:32 
Started by JJengineering - Last post by Riven
Every Wire is passed to exactly two Nodes, not more.

You don't really have to adjust the algorithm & data structure for a grid based map. Make a Node for every tile, and add Wires during gameplay. Sure, this can be optimized, but make it work first - optimize if it actually turns out to be slow.

Pages: 1 ... 5 6 [7] 8 9 10
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (31 views)
2014-10-27 03:28:38

TehJavaDev (26 views)
2014-10-27 03:27:51

DarkCart (40 views)
2014-10-26 19:37:11

Luminem (21 views)
2014-10-26 10:17:50

Luminem (25 views)
2014-10-26 10:14:04

theagentd (31 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (57 views)
2014-10-16 15:22:06

Norakomi (46 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
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

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!