wreed12345
|
 |
«
Reply #30 - Posted
2013-03-28 15:35:42 » |
|
Sure! It turned out to be pretty simple using libgdx. Ill just go ahead and share the whole class: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
| package com.reed.birdseye;
import java.util.Random;
import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.BitmapFont; import com.badlogic.gdx.graphics.g2d.SpriteBatch;
public class Mob {
final int distanceFromMob = 100; Random r = new Random(); int x = 500; int y = 500;
int direction = r.nextInt(5) + 1; float mobTime = r.nextInt(3) + 1; final int speed = 1;
void draw(SpriteBatch batch, BitmapFont font) { batch.draw(Assets.creeper, Level.levelX + x, Level.levelY + y); if (closeEnough()) font.draw(batch, "I'm a mob", 50, 100); } void movement() { mobTime -= Gdx.graphics.getDeltaTime(); if (direction == 0 && mobTime > 0) { y += speed; } else if (direction == 1 && mobTime > 0) { y -= speed; } else if (direction == 2 && mobTime > 0) { x -= speed; } else if (direction == 3 && mobTime > 0) { x += speed; } else if (direction == 4 && mobTime > 0) { } else { mobTime = r.nextInt(3) + 1; direction = r.nextInt(5) + 1; } }
void boundingArea(int xCord, int yCord, int width, int height) { if (x > xCord + width) direction = 2; if (x < xCord) direction = 3; if (y > yCord + height) direction = 1; if (y < yCord) direction = 0; } boolean closeEnough() { return (Math.sqrt((Level.levelX + x - Level.middleX) * (Level.levelX + x - Level.middleX) + (Level.levelY + y - Level.middleY) * (Level.levelY + y - Level.middleY)) < distanceFromMob); } } |
If you have any questions about this feel free to ask
|
|
|
|
wreed12345
|
 |
«
Reply #31 - Posted
2013-03-28 18:42:06 » |
|
Just finished implementing a simple crafting system (not exactly crafting yet but the concept is all there) that is available in the updated download. This download includes: new Mob ai, crafting menu (can be accesed by pressing z during gameplay), farm and house have been excluded from this update until some small bugs are fixed. here is a screenshot of the crafting menu:  The mob is viewable in the bottom left area of the map. Please report any bugs / problems, enjoy! Download link: http://goo.gl/rf79e
|
|
|
|
wreed12345
|
 |
«
Reply #32 - Posted
2013-03-29 18:21:36 » |
|
For everyone who was having trouble with opening this on a Mac I will do little tutorial to help you out. 1. Open up terminal 2. type java -jar (drag the JAR file to the Terminal window) 3. Make sure you have a space between -jar and the file you dragged into the window 4. Press enter and enjoy!
|
|
|
|
Games published by our own members! Check 'em out!
|
|
wreed12345
|
 |
«
Reply #33 - Posted
2013-03-30 16:00:58 » |
|
Just spent some time recently to add a new "Mining Robot" which basically goes around collecting a single ore every minute. Eventually you will need to supply it with coal to keep it going but for now it works. Also I added a new iron and copper ore. Copper will be needed to build electronics (such as the mining robot) and iron is used for structures. The top bar of items / amounts has been removed and replaced with a blank bar which eventually will contain tools to use to make a particular task faster / easier. Since there are currently no tools it is blank. You can view your inventory by clicking the box with the slashes in it. Here is the mining robot and its simple GUI.  At the moment its pretty simple but as I said above it will gain more features soon. Also here are the new ores and the new Inventory system.  the left ore is copper and the right is iron Eventually I think I will add pictures to the inventory / robot gui so you know which is which. Here is the updated download: http://goo.gl/RYovl
|
|
|
|
Apex5
|
 |
«
Reply #34 - Posted
2013-03-30 22:20:41 » |
|
Looking great so far  Do you have any plans to procedurally generate content? (presuming so far you're using a fixed grid owtte). I always find it hard in rpg projects to keep code as clean as possible X) Good luck!
|
|
|
|
Jimmt
|
 |
«
Reply #35 - Posted
2013-03-30 22:28:35 » |
|
What font is that?
|
|
|
|
wreed12345
|
 |
«
Reply #36 - Posted
2013-03-30 22:34:27 » |
|
Looking great so far  Do you have any plans to procedurally generate content? (presuming so far you're using a fixed grid owtte). I always find it hard in rpg projects to keep code as clean as possible X) Good luck! Eventually I do plan on setting up a randomly generated terrain, right now it is not set in a fixed grid however.
|
|
|
|
wreed12345
|
 |
«
Reply #37 - Posted
2013-03-30 22:35:10 » |
|
What font is that?
The cooler looking one in the menus? or the one that is drawn when you go over an object?
|
|
|
|
wreed12345
|
 |
«
Reply #38 - Posted
2013-04-07 02:51:08 » |
|
Just created and added a super cool tree falling animation made with Spine  The animation doesn't completely give it justice so go ahead and download the updated game here: http://goo.gl/f0xAwIf you run out of trees to place just go ahead and click z and place a new tree through the craft menu. If you have any suggestions for more animations to add or anything about the game in general feel free to leave a comment
|
|
|
|
Jimmt
|
 |
«
Reply #39 - Posted
2013-04-07 03:53:53 » |
|
What font is that?
The cooler looking one in the menus? or the one that is drawn when you go over an object? argh late reply by me meant the one in the menus
|
|
|
|
Games published by our own members! Check 'em out!
|
|
wreed12345
|
 |
«
Reply #40 - Posted
2013-04-07 04:10:57 » |
|
Cgf locust resistance
|
|
|
|
matheus23
|
 |
«
Reply #41 - Posted
2013-04-07 08:25:00 » |
|
Just created and added a super cool tree falling animation made with Spine  Ahahaha  This looks awesome!  Still needs some art-work on the trunk though 
|
|
|
|
isteinvids
|
 |
«
Reply #42 - Posted
2013-04-07 10:42:39 » |
|
Try adding infinite terrain, with the background grass texture on repeat, and trees and stuff added randomly on terrain. Besides figuring out an algorithm for random trees, it shouldn't be too hard.
|
|
|
|
wreed12345
|
 |
«
Reply #43 - Posted
2013-04-07 12:41:45 » |
|
Ahahaha  This looks awesome!  Still needs some art-work on the trunk though  [/quote] I did notice after staring at it, that it looks a little awkward 
|
|
|
|
wreed12345
|
 |
«
Reply #44 - Posted
2013-04-07 12:43:15 » |
|
Try adding infinite terrain, with the background grass texture on repeat, and trees and stuff added randomly on terrain. Besides figuring out an algorithm for random trees, it shouldn't be too hard.
That's a goal, but do you have any suggestions on making the unlimited terrain? I really am not sure about that one.... The trees seems easy although detecting for overlapping trees might take some thinking. Also just as a follow up any chance that AI code helped you out?
|
|
|
|
isteinvids
|
 |
«
Reply #45 - Posted
2013-04-07 13:28:37 » |
|
Didn't really help cause I don't use libgdx, I personally prefer Slick2d, but it may have been helpful for others xD
|
|
|
|
RobinB
|
 |
«
Reply #46 - Posted
2013-04-07 13:50:48 » |
|
Didn't really help cause I don't use libgdx, I personally prefer Slick2d, but it may have been helpful for others xD
The AI part is not really libgdx specific haha 
|
|
|
|
wreed12345
|
 |
«
Reply #47 - Posted
2013-04-07 14:00:37 » |
|
Didn't really help cause I don't use libgdx, I personally prefer Slick2d, but it may have been helpful for others xD
Well just check out this article if you are having trouble with deltaTime problems.
|
|
|
|
wreed12345
|
 |
«
Reply #48 - Posted
2013-04-07 14:01:55 » |
|
also, @isteinvids do you have any idea on how to get unlimited (background) terrain working? I am trying to find some stuff on the internet but no luck so far.
|
|
|
|
isteinvids
|
 |
«
Reply #49 - Posted
2013-04-07 14:05:54 » |
|
|
|
|
|
wreed12345
|
 |
«
Reply #50 - Posted
2013-04-07 14:25:11 » |
|
That worked pretty good although still not unlimited (stuck at a fixed amount)
|
|
|
|
|
wreed12345
|
 |
«
Reply #52 - Posted
2013-04-08 21:18:02 » |
|
Could you give me some insight on the variable names?
|
|
|
|
isteinvids
|
 |
«
Reply #53 - Posted
2013-04-08 21:48:02 » |
|
Could you give me some insight on the variable names? grX and grY are just image width and height, gX and gY are position of grass texture, and you shouldn't have to use toggleX. Basically, the texture is in middle, and if it moves exactly it's own width/height, it moves back to it's original place. So, if the image is repeated, it gives the illusion of infinite terrain.
|
|
|
|
isteinvids
|
 |
«
Reply #54 - Posted
2013-04-08 21:54:26 » |
|
Btw, if you couldn't tell, I'm really bad at explaining my own code :/
|
|
|
|
HeroesGraveDev
|
 |
«
Reply #55 - Posted
2013-04-09 08:19:03 » |
|
You got a name yet?
|
|
|
|
wreed12345
|
 |
«
Reply #56 - Posted
2013-04-09 10:44:08 » |
|
You got a name yet?
Not yet.... any suggestions for a name?
|
|
|
|
wreed12345
|
 |
«
Reply #57 - Posted
2013-04-12 21:37:51 » |
|
@isteinvids I reached my message limit for the day concerning that repeated texture. Do you have an email to talk with?
|
|
|
|
isteinvids
|
 |
«
Reply #58 - Posted
2013-04-12 21:42:36 » |
|
@isteinvids I reached my message limit for the day concerning that repeated texture. Do you have an email to talk with?
You got Skype? Mine is emir.rhouni
|
|
|
|
wreed12345
|
 |
«
Reply #59 - Posted
2013-04-12 21:47:40 » |
|
Mine is wreed12345 , I couldn't add you when I tried, is yours private or something? Maybe try adding me
|
|
|
|
|