thez3r0312
JGO n00b  Posts: 18
|
 |
«
on:
2012-01-14 19:22:41 » |
|
So I'm very new to java I've been programming for only about 2 weeks. The past couple days I have been working on this tower defense game. Its in its very early stages many things don't work in it however for two days of work I'm pretty happy! Let me know what you think all feed back is welcome! I'll continue to post as I change things! <youtube> http://www.youtube.com/watch?v=l4XrAnWxev4 VIDEO 1 http://www.youtube.com/watch?v=Ymww6vpgndA VIDEO 2 UPDATENew screen shot  New game over screen I've been working on:  New first wave zombie sprite:  New tower: 
|
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #1 on:
2012-01-16 21:22:16 » |
|
Any thoughts?
|
|
|
|
|
ra4king
JGO Kernel      Posts: 3156 Medals: 196
I'm the King!
|
 |
«
Reply #2 on:
2012-01-16 22:54:27 » |
|
You've only been programming in general....for 2 weeks...  It's looking good so far, keep up the good work 
|
|
|
|
Games published by our own members! Go get 'em!
|
|
ReBirth
JGO Wizard     Posts: 1275 Medals: 19
|
 |
«
Reply #3 on:
2012-01-16 23:33:33 » |
|
Can't watch youtube here hehehe 
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #4 on:
2012-01-16 23:54:40 » |
|
You've only been programming in general....for 2 weeks...  It's looking good so far, keep up the good work  Thank you! I still have a lot to figure out though! Uploaded the new game over screen!
|
|
|
|
|
asphaltgalaxy
JGO n00b  Posts: 29 Medals: 1
|
 |
«
Reply #5 on:
2012-01-18 12:47:08 » |
|
Nice artwork as I can see. Waitin for any version to try it 
|
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #6 on:
2012-01-18 20:23:43 » |
|
Nice artwork as I can see. Waitin for any version to try it  Thanks! its taken me forever to do all the art! Hopefully I can have a demo up soon!
|
|
|
|
|
ReBirth
JGO Wizard     Posts: 1275 Medals: 19
|
 |
«
Reply #7 on:
2012-01-18 23:08:38 » |
|
Now you put the images. The tower is cool, looks like helmet 
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #8 on:
2012-01-19 16:52:15 » |
|
Now you put the images. The tower is cool, looks like helmet  I was going for a kind of an Iron man looking tower haha, ill post more tonight either pictures or videos.
|
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #9 on:
2012-01-20 19:34:35 » |
|
Does anyone know if i can use a 3d modeler with java? Like blender or something like that.
|
|
|
|
|
Games published by our own members! Go get 'em!
|
|
ReBirth
JGO Wizard     Posts: 1275 Medals: 19
|
 |
«
Reply #10 on:
2012-01-20 23:16:53 » |
|
You can, with help of library such as LWJGL.
|
|
|
|
ra4king
JGO Kernel      Posts: 3156 Medals: 196
I'm the King!
|
 |
«
Reply #11 on:
2012-01-21 00:49:03 » |
|
LWJGL is a simple binding to OpenGL. OpenGL has no clue what a model is. All it knows how to do is render geometry and textures.
@thez3r0312 To load a model into OpenGL, you have to use a library that allows you to do that. I believe libGDX has classes that load OBJ and MD5 models.
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #12 on:
2012-01-21 19:58:50 » |
|
So i want to make my towers and enemies like this:  Anyone have any ideas how i would make my characters/towers 3d like this and animated? Also anyone have an example code of a targeting system for the towers that makes towers pivot and follow the characters.
|
|
|
|
|
ReBirth
JGO Wizard     Posts: 1275 Medals: 19
|
 |
«
Reply #13 on:
2012-01-21 23:53:17 » |
|
animation is simply change sprite in constant time. Target an enemy and calculate the rotation for tower so it looks like following, and shoot in desired rate.
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #14 on:
2012-01-22 00:25:06 » |
|
animation is simply change sprite in constant time. Target an enemy and calculate the rotation for tower so it looks like following, and shoot in desired rate.
wont i need multiple images for that though? otherwise the whole tower image is going to shift instead of just the barrel of the tower.
|
|
|
|
|
ReBirth
JGO Wizard     Posts: 1275 Medals: 19
|
 |
«
Reply #15 on:
2012-01-22 00:29:18 » |
|
For creating smooth animation, it's pretty common to have multiple sprites/images, except yours are procedural generated. If you want whole tower to rotate, it'll be neat to have 3D approach.
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #16 on:
2012-01-22 00:39:01 » |
|
Considering i have very little java experience this sounds quite complicated. Basically if i understand correctly i have to have the tower target the enemy then depending on its location choose an image that accurately depicts where is should be facing?
and to make this smooth ill need at least 20 images that each are slightly rotated in order to get a smooth rotating image?
|
|
|
|
|
ReBirth
JGO Wizard     Posts: 1275 Medals: 19
|
 |
«
Reply #17 on:
2012-01-22 00:49:13 » |
|
Yeah you can do that, but not efficient I think. You can have less image by rotating with code (generated on fly) but it's expensive with java2d so you better bring it to opengl. My suggest is to leave animation first and create logic first. In the end you'll have a game where the towers are static but shoot enemy with right directed bullets. Then you can enchant animation.
|
|
|
|
ra4king
JGO Kernel      Posts: 3156 Medals: 196
I'm the King!
|
 |
«
Reply #18 on:
2012-01-22 00:52:49 » |
|
You don't need many images to produce a smooth animation. For example, a smooth looking walking animation is only 3-4 images. Animation is very easily simulated with little amount of frames 
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #19 on:
2012-01-22 00:59:03 » |
|
im gonna do the shooting system tonight, and ill put up a video of it, if anyone can suggest how i do the image animation after you see it let me know. I have some ideas but i really dont know if they are going to work!
|
|
|
|
|
|
|
ra4king
JGO Kernel      Posts: 3156 Medals: 196
I'm the King!
|
 |
«
Reply #21 on:
2012-01-22 04:26:19 » |
|
It's looking good, great progress! One comment: "public class ad ... " Really?!  If you want to obfuscate your code, use a tool like Proguard. Don't do it manually! 
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #22 on:
2012-01-22 04:30:39 » |
|
One comment: "public class ad ... " Really?!  haha just laziness. But thanks for checking it out! I'm trying to get the image to follow the line right now.
|
|
|
|
|
ReBirth
JGO Wizard     Posts: 1275 Medals: 19
|
 |
«
Reply #23 on:
2012-01-22 07:07:27 » |
|
Or that's really Ad class, for showing ad before you purchase the game 
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #24 on:
2012-01-22 23:35:50 » |
|
i really cant figure out how to make the tower rotate toward enemies, anyone have any ideas?
|
|
|
|
|
ra4king
JGO Kernel      Posts: 3156 Medals: 196
I'm the King!
|
 |
«
Reply #25 on:
2012-01-22 23:45:45 » |
|
All you need is the rotation angle of the tower when it faces the enemy: 1 2 3 4 5
| double rot = Math.atan2(enemy.y-tower.y,enemy.x-tower.x);
g.rotate(rot,tower.x+tower.width/2,tower.y+tower.height/2); |
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #26 on:
2012-01-23 00:09:39 » |
|
Ok so here is my code and its getting an error, 1 2 3 4 5 6 7 8 9
| double rot; for(int i = 0; i < tower.length; i++){ rot = Math.atan2(mobs[i].y - tower[i].y, mobs[i].x - tower[i].y); if(towerID[i] != air) { g.drawImage(aa.f.bp.tower[towerID[i]], tower[i].x, tower[i].y, tower[i].width, tower[i].height, null); g.rotate(rot, tower[i].x + tower.length / 2, tower[i].y + tower.height / 2); } } |
|
|
|
|
|
ra4king
JGO Kernel      Posts: 3156 Medals: 196
I'm the King!
|
 |
«
Reply #27 on:
2012-01-23 00:17:39 » |
|
you should be rotating before drawing the image then you need to reset the transform: 1 2 3
| g.rotate... g.drawImage... g.getTransform().setToIdentity(); |
|
|
|
|
thez3r0312
JGO n00b  Posts: 18
|
 |
«
Reply #28 on:
2012-01-23 00:41:16 » |
|
ok so i have some rotation but its very random and all over the place, and when i place a second tower it rotates around the first one. Anyone see why? 1 2 3 4 5 6 7 8 9 10 11
| double rot; Graphics2D g2d = (Graphics2D) g; for(int i = 0; i < tower.length; i++){ rot = Math.atan2(mobs[i].y - tower[i].y, mobs[i].x - tower[i].y); if(towerID[i] != air) { g2d.rotate(rot, tower[i].x + tower[i].width / 2, tower[i].y + tower[i].height / 2); g.drawImage(aa.f.bp.tower[towerID[i]], tower[i].x, tower[i].y, tower[i].width, tower[i].height, null); } } |
|
|
|
|
|
ra4king
JGO Kernel      Posts: 3156 Medals: 196
I'm the King!
|
 |
«
Reply #29 on:
2012-01-23 00:48:57 » |
|
You need to reset the transform like I showed you in the previous post! 
|
|
|
|
|