Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (741)
Games in Android Showcase (225)
games submitted by our members
Games in WIP (823)
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  
  Correct Isometric block spawn  (Read 1449 times)
0 Members and 1 Guest are viewing this topic.
Offline kingroka123
« Posted 2013-05-30 20:53:05 »

hey jgo,

how can i fix my isometric block engine so that it looks correct?

here it is now:



here is the code used to generate

1  
2  
3  
4  
5  
6  
7  
8  
size=32;
  for(x=1; x<width*mapSize;x+=size){
            for(y=1;y<height*mapSize;y+=size){
b.addBlock(new ObjTest(x,y);..this is what is being made


}
}


any help would be awesome, thanks
Offline Opiop
« Reply #1 - Posted 2013-05-30 21:11:36 »

Sigh... please read up on what a isometric renderer actually does.
Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 167
Projects: 5
Exp: 6 years



« Reply #2 - Posted 2013-05-30 21:17:26 »

Sigh... please read up on what a isometric renderer actually does.
Indeed, at least put some effort. Seriously.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kingroka123
« Reply #3 - Posted 2013-05-30 21:18:48 »

im nit trying to make any thing fancy but i will
Offline GabrielBailey74
« Reply #4 - Posted 2013-05-30 21:27:43 »



That made me 'lol' :>

But it's now forcing me to make a isometric tile engine 0_0 (First time)

Offline matheus23

JGO Kernel


Medals: 138
Projects: 3


You think about my Avatar right now!


« Reply #5 - Posted 2013-05-31 08:52:54 »

You, Mr., need to improve some things...

1. Format your code. Even if it's in the internet. And use // comments... Smiley

1  
2  
3  
4  
5  
6  
int size=32;
for(x=1; x<width*mapSize;x+=size) {
    for(y=1;y<height*mapSize;y+=size) {
        b.addBlock(new ObjTest(x,y); // this is what is being made
    }
}

Or better: Format it right Cheesy Anyways, I like that you didn't start like many other, who simply got here and asked how to do that without having done anything. Also, the code to be changed is already given, so guys, the answer is so simple? :/ Anyways Smiley

The solution: Put less space between the y positions of your objects, because you're not viewing from the top anymore, but from the side and also 'indent' objects at each 2nd row:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
// I changed the code from 
for(int x = 0; x < mapSize; x++) {
    for(int y = 0; y < mapSize; y++) {
        int xoffset = 0;
        if (y % 2 == 0) // every second row
            xoffset = width / 2; // Indent the row

        b.addBlock(new ObjTest(xoffset + x * width, y * (height / 2)); // the magic happens here
        // The two for-loops don't iterate through the
        // world pixel-based anymore, but _block_ based.
        // So I'm iterating the column and rows.
    }
}


The equation got more complicated, but that's the nature of isometric stuff.
More information:
  - How can I do it, so that the tiles outside my view aren't rendered? The answer
  - How can I get the tile I clicked on? Look here
  - How can I be really cool and do that with Matrix stuff? Look at DrZoidberg's code!


Hope that helps Smiley

See my:
    My development Blog:     | Or look at my RPG | Or simply my coding
http://matheusdev.tumblr.comRuins of Revenge  |      On Github
Pages: [1]
  ignore  |  Print  
 
 

 
xxMrPHDxx (23 views)
2017-11-21 16:21:00

xxMrPHDxx (14 views)
2017-11-21 16:14:31

xxMrPHDxx (17 views)
2017-11-21 16:10:57

Ecumene (117 views)
2017-09-30 02:57:34

theagentd (152 views)
2017-09-26 18:23:31

cybrmynd (260 views)
2017-08-02 12:28:51

cybrmynd (254 views)
2017-08-02 12:19:43

cybrmynd (249 views)
2017-08-02 12:18:09

Sralse (260 views)
2017-07-25 17:13:48

Archive (882 views)
2017-04-27 17:45:51
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

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
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!