Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (516)
Games in Android Showcase (123)
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]
  ignore  |  Print  
  Correct Isometric block spawn  (Read 438 times)
0 Members and 1 Guest are viewing this topic.
Offline kingroka123

JGO Ninja


Medals: 36
Projects: 6
Exp: 1 year


Gamer's Helmet


« 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 opiop65

JGO Kernel


Medals: 156
Projects: 7
Exp: 3 years


JumpButton Studios


« 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: 136
Projects: 4
Exp: 3 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

JGO Ninja


Medals: 36
Projects: 6
Exp: 1 year


Gamer's Helmet


« 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: 110
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  
 
 
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.

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

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

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

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

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

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

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

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

Norakomi (47 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!