Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (512)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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  
  Initial Sprite Location  (Read 1549 times)
0 Members and 1 Guest are viewing this topic.
Offline MonsterOfCookie

Junior Duke


Medals: 2


Gar


« Posted 2013-01-08 09:01:59 »

Hey People

Hope everyone is well!

Question for the floor.

Previously in my platform games I have always used another tilemap layer as a way of placing sprites in game (e.g. enemies, player starting location) then pre-processed it on load of a level to place things.

My question is, is there a better of doing this? Have I done this completely the wrong way?

Cookie

Offline princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #1 - Posted 2013-01-08 09:44:45 »

Works for me!

Cas Smiley

Offline MonsterOfCookie

Junior Duke


Medals: 2


Gar


« Reply #2 - Posted 2013-01-08 09:51:58 »

Awesome, thanks.

Always best to check before ploughing on!

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2013-01-08 14:41:26 »

use a script file

spawn enemy_x 400 500

something like that

Offline MonsterOfCookie

Junior Duke


Medals: 2


Gar


« Reply #4 - Posted 2013-01-08 16:20:27 »

Interesting idea, personally thought I would prefer the tile map approach as then you can easily see placement and have the pre-processing take care of the precise X&Y coordinates of the sprite.

Thanks for the input though Smiley

Offline Best Username Ever

Junior Duke





« Reply #5 - Posted 2013-01-09 01:35:44 »

Probably not a great idea. I would use it if it saved me time, but there is an alternative that would save more time. Just read three ints (enemy type, x, y) from a file and loop until you reach the end. An extra tilemap layer could use up to twice as much disk space.

If you had to load things at run time and could not store every enemy in memory at the same time, then you would not want to use that method. However, since you're reading everything in once at the start, I would just use whatever saves the most space or saves programmer time on writing a preprocessor.
Offline MonsterOfCookie

Junior Duke


Medals: 2


Gar


« Reply #6 - Posted 2013-01-09 09:27:31 »

Hmm - You make a good point, never thought about that.

Perhaps the tilemap soln mixed with your idea. So there is a process at build stage that rips out the enemy tile layer and produces a type -> x,y file.

Offline princec

JGO Kernel


Medals: 404
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #7 - Posted 2013-01-09 13:15:33 »

We're already using a map layer anyway for this - we have an "item" layer, and one of our many items is "spawn droid g101". At map load we scan the map item layer for tiles and process them. So we not only create droids, we're also creating turrets, lights, doors, and terminals. It's a very handy mechanism because what's going to be spawned can be represented in the map editor as a tile and so you can see what it's all laid out like and edit it in exactly the same way as you edit any other tile.

Cas Smiley

Offline alesky

Junior Duke


Medals: 3
Exp: 15 years


mmm....


« Reply #8 - Posted 2013-01-09 13:46:43 »

I work with more tiled map layer

i use different tiled map based on different scope, this give you a flexibility to manage this stuff separate also in the code
instead to have a bundle of code that have to think of all, you ave different pieces for specific scope

1 tile for background
1 tile for solid items
1 tile for enemy
.....
.....
.....
1 tile for final grafica effect


and if you manage all this logic with the pattern chain and the pattern command together,
you can introduce every time more layer with little effort

 

Offline Best Username Ever

Junior Duke





« Reply #9 - Posted 2013-01-10 00:13:26 »

We're already using a map layer anyway for this - we have an "item" layer, and one of our many items is "spawn droid g101". At map load we scan the map item layer for tiles and process them. So we not only create droids, we're also creating turrets, lights, doors, and terminals. It's a very handy mechanism because what's going to be spawned can be represented in the map editor as a tile and so you can see what it's all laid out like and edit it in exactly the same way as you edit any other tile.

Cas Smiley

That brings up a good point. It is a good idea to visually represent those objects as extra layers in a tile map editor, assuming you only have at most one object of each type per grid location or can support different sized grids if you need to. If you have a good tile map editor already, then it's less work to treat it as a tile in a tile editor. If much less than one third of your grid is filled with enemies or other objects, then I would still use a "list" of tiles and not a "2D array" of tiles for those layers in my file format, even if not in my map editor UI.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

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

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

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

lcass (36 views)
2014-10-15 16:18:58

TehJavaDev (66 views)
2014-10-14 00:39:48

TehJavaDev (65 views)
2014-10-14 00:35:47

TehJavaDev (55 views)
2014-10-14 00:32:37

BurntPizza (72 views)
2014-10-11 23:24:42

BurntPizza (43 views)
2014-10-11 23:10:45

BurntPizza (84 views)
2014-10-11 22:30:10
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!