Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: block based experiments in java.....  (Read 1080 times)

xaritscin

  • Bay Watcher
    • View Profile
block based experiments in java.....
« on: July 19, 2016, 07:30:31 pm »

so i wake up one day thinking. "hey, i have a code for a random generated tilegrid somewhere on my Unity Proyects, i should see if i can use it to make the worldgen for my 2D survival game".

then i get a notice from Visual Studio telling me that i had to upgrade the license because it was a 30 day trial. fuck you Unity Engine.

so. it has come this. after thinkering around with some codes of my days on computer graphics i had started to give some form to a Java based worldgenerator in Netbeans.

here's the first iteration. (its in spoilers because is too big)

Spoiler (click to show/hide)

so. yeah, its one tile right now. nothing too fancy. i have a "board" class that contains a constructor and the paintComponent method for drawing the block on screen. (extends JFrame)

the Tile class contains an X and Y element and a buffered image for its sprite. it contains a try catch method on its constructor and a Draw method which is the one in charge of generating the object. (Extends JPanel)

finally the main class has the application initialization. (your average main class for setting the window and UI and that stuff)

nothing too fancy. now, my next step is to be able to generate the same tile in a repeated pattern on the screen. however, my programming skills have reached their limit since i was able to craft this using old pieces of code i had scattered from my Computer Graphics class, which wasnt too much usefull IMO. i could barely mount an space shooter game with it with some classmates.

i tried to pass the rest of the day looking at tutorials but im not sure if what i have implemented would be capable of doing what i was thinking to do. so any feedback is appreciated.

i hope to at least get this to completion, and not have to scrap it like with the space game. which otherwise cant be completed (again, F**K YOU UNITY)

thanks for watching....
Logged

xaritscin

  • Bay Watcher
    • View Profile
Re: block based experiments in java.....
« Reply #1 on: July 20, 2016, 10:47:24 am »

Spoiler (click to show/hide)

fleshed out more methods inside the Tile class which allowed me to define a tle by its SpriteCode and XY positions.

a method is in charge of assigning the corresponding image by using if statements and try catchers.

the board class was modified in order to be able to paint both components. since the first iteration was basically drawing a complete screen only for 1 component.

so yeah. right now i can define 2 tiles on the main app and asign them to the board so they can be rendered on runtime. still, it sounds really clunky.

i tried to change the paintComponent method so i could just tell it draw the tiles on the main class. but i got into some issues with the Graphics g component which is required for rendering the tiles.

EDIT: added a sky blue background to the app. no images yet until i figure out the rest.
« Last Edit: July 20, 2016, 11:03:32 am by xaritscin »
Logged

lemmily

  • Bay Watcher
    • View Profile
    • BatFinchBears
Re: block based experiments in java.....
« Reply #2 on: July 21, 2016, 06:02:27 am »

Just as a note : if you use the visual studio community edition you don't need to pay for anything!

But having to approach a similar project via a different route can be a really good experience and helps you to understand both your project and the code better sometimes! So keep it up :)

Logged
I make furry things - BatFinch Bears

xaritscin

  • Bay Watcher
    • View Profile
Re: block based experiments in java.....
« Reply #3 on: July 21, 2016, 01:10:14 pm »

Just as a note : if you use the visual studio community edition you don't need to pay for anything!

But having to approach a similar project via a different route can be a really good experience and helps you to understand both your project and the code better sometimes! So keep it up :)

honestly i didnt know what happened with that. when i started those projects unity was using Monodevelop. and suddenly some months ago i patch to the last version and boom, Visual Studio. i said ok, it seems to be the same, no problem. and then 4 months later it tells me that the license was outdated.

i mean, im using the free version of unity. it shouldnt come with a trial version for coding...
Logged

itisnotlogical

  • Bay Watcher
  • might be dat boi
    • View Profile
Re: block based experiments in java.....
« Reply #4 on: July 21, 2016, 05:47:55 pm »

You can change it back to monodevelop in the preferences.
Logged
This game is Curtain Fire Shooting Game.
Girls do their best now and are preparing. Please watch warmly until it is ready.

xaritscin

  • Bay Watcher
    • View Profile
Re: block based experiments in java.....
« Reply #5 on: July 24, 2016, 11:17:46 am »

You can change it back to monodevelop in the preferences.

really?, i thought they were just shoving visual studio to the users...oh well, guess this thread can be closed then.
Logged