Show Posts
|
|
Pages: [1]
|
|
1
|
Game Development / Newbie & Debugging Questions / Re: Movement is acting a bit odd
|
on: 2013-05-15 21:27:59
|
Sorry for the later response, just got home from a trip. Anyways, They don't vary by that much. It might just be a graphical component or just myself. Here are some read-outs: 1 2 3 4 5 6 7 8 9 10
| 2.000003600087018 Up 2.000027040088614 Up 2.0000108401326906 Right 2.0000342801343614 Right 2.000021600135952 Right 2.0000198801734625 Down 2.0000072001750118 Down 2.0000306401766097 Down 2.000009040234559 Left 2.0000324802362086 Left |
This is using the speed * delta stuff, hence the variety. It's not super-important, so I'm not stressing. But I'd prefer to get this out of the way, and I have no idea how to go about doing so. Again, thanks in advance.
|
|
|
|
|
2
|
Game Development / Newbie & Debugging Questions / Movement is acting a bit odd
|
on: 2013-05-14 19:36:02
|
Hello! I haven't used this forum that much besides browsing, but I find myself in a bit of a spot here. In a game I'm working on, the character moves around according to "Speed * game.delta", which is what it's supposed to be. The problem (and this is mostly a preference thing) is that when my character moves either up or left, he goes slightly faster than right or down, but it might just be appearances. I was just hoping that someone might be able to help me out here. Github to Code: https://github.com/RyanMB97/AcreageClasses that might be at fault: Tiles themselves (DirtTile, GrassTile, StoneTile, etc) in respective classes Player movement (Player class) How the level is drawn/updated (Level class) My own coding style? Code Itself: From the "Player" 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
| public void tick(Game game) { this.game = game; bounding.setBounds(x, y, width, height); speed = 2 * game.delta;
worldEdgeCollision();
movement(); }
private void movement() {
if (game.input.left.down && canLeft) { game.xOffset -= speed; directionFacing = 2; System.out.println(speed); } if (game.input.right.down && canRight) { game.xOffset += speed; directionFacing = 3; System.out.println(speed); } if (game.input.up.down && canUp) { game.yOffset -= speed; directionFacing = 1; System.out.println(speed); } if (game.input.down.down && canDown) { game.yOffset += speed; directionFacing = 0; System.out.println(speed); } } |
How I Render Tiles in "Level" class 1 2 3 4 5 6 7 8 9 10
| public void renderLevel(Graphics g) { for (int y = 0; y < game.worldHeight; y++) { for (int x = 0; x < game.worldWidth; x++) { if (tileArray[x][y].x >= game.player.x - (game.getWidth() / 2) - 32 && tileArray[x][y].x <= game.player.x + (game.getWidth() / 2) + 32 & tileArray[x][y].y >= game.player.y - (game.getHeight() / 2) - 32 && tileArray[x][y].y <= game.player.y + (game.getHeight() / 2) + 32) { tileArray[x][y].render(g); } } } } |
The rendering method itself is a bit odd, since I tossed it together on the spot. In brief explanation, it doesn't render tiles that are off of the viewable screen, plus 1 more for more seamless viewing while moving. An example of a tile being drawn, "DirtTile" class 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public void tick(Game game) { this.game = game;
x = oX - game.xOffset; y = oY - game.yOffset; bounding = new Rectangle(x, y, size, size); bounding.setBounds(x, y, size, size); }
public void render(Graphics g) { g.drawImage(game.res.tiles[tileID], x, y, game);
if (game.showGrid) { g.setColor(Color.WHITE); g.drawRect(x, y, size - 1, size - 1); }
if (showBorders) { g.setColor(Color.BLACK); g.drawRect(x, y, size - 1, size - 1); } } |
Sorry if the thread is a bit long, but this is really bothering me. Also, any advice or information to anything not of this topic is much appreciated. Thanks in advance for any and all responses!
|
|
|
|
|
3
|
Games Center / WIP games, tools & toy projects / Re: My First Game, "Spaceshooter" -Abandoned-
|
on: 2013-03-28 03:54:30
|
|
Well, when you put it that way, I feel sort of crumby. Guess that I can pull it back into production for a day or 2 of my school vacation and patch it up to play-ability. I'd hate seeing myself as a "Well, if you do it EXACTLY like this", but then having no good examples of my own. Would be slightly hypocritical... Anyways, thanks for the "motivation" (Read: kick to the behind). Will release a "Finished" version sometime in the next 2 days to provide myself closure.
|
|
|
|
|
4
|
Games Center / WIP games, tools & toy projects / Re: My First Game, "Spaceshooter" Abandoned! Sorry!
|
on: 2013-03-28 03:34:59
|
|
Game fell through. I just couldn't think of ways to get it further based upon my limited experience. Also, I accidentally asked for a conversion! Ignore it! I thought it was something like "Would you like to move it somewhere", then I could ask for it to be moved to archive or something like that. Again, sorry!
Anyways, game is abandoned. Hopefully, at some point in the future, I can restart the entire thing. But now, it is done with. Anyone that wishes to use the code, images, or whatever, feel free to use the github link and stuff if that's even possible. Hopefully my next project is more successful!
-Ryan Newbie!
|
|
|
|
|
5
|
Game Development / Newbie & Debugging Questions / Re: What have been/are your learning techniques?
|
on: 2013-03-28 03:15:40
|
|
- Why did you want to start programming? (What was your motivation?) -> I started programming in Java (First language!) because of Minecraft (Probably the most commonly used reason/inspiration) back when it was 1.6 Beta or something. Obviously, once I learned that I couldn't make a Minecraft clone in 10 seconds, I dropped it for a bit. but I eventually came back and worked my way up.
- Why did you choose to begin with the language you begun with? And if applicable, why are you using the language you are using now? -> Sorta answered that in the last one. I chose Java because of Minecraft, and afterwards because it was (To me), really simple and I was already in a Java state of mind.
- How long ago did you get started? And where are you at now? -> Started back towards MC Beta 1.6, so give or take a year or 2 (I have a HORRIBLE sense of time!). I am currently up to the state where I can make a sort-of Mario clone (With physics and stuff!)! This is counting my on-off periods of inactivity (Of which I am currently in Limbo, and out of ideas, my worst enemy).
- What learning methods did you employ personally to help you develop your skills in programming? -> Here's my primary reason for replying. My way of learning is very odd (As far as I can tell from my class mates and stuff). Other people, far as I know (Very limited, Go social life!), learn by connections, visualizations, and generally having an idea of what it does. When I learn something new, I take a while after learning a rather large chunk, and actively think on what it can do. I could summarize it as, well, stripping it to it's base form and knowing EXACTLY what it can do. This is in contrast to tutorials that have a very specific goal, and don't generalize, like "This method lets me create a rotation around the player!", but not the general principle behind it.
- What advice could you give to other programmers who might be feeling a little lost in what direction to take? -> I was SO lost, up until the past stretch of time. What you want to do is settle into a sort of... niche? Find something comfortable, camp in it a bit, and stretch it to it's full potential, then move on. This way you have a SOLID background of fall-back options if you ever get stuck. The pyramids wouldn't work upside-down, now would they? You need a strong foundation and support.
- Is there anything you believe should be a "Rite of Passage" for programmers (such as the need to create hello world, or a snake program, etc etc). -> In my brief and personal belief about programming and it's "Rite of Passage" is that there is none. There are milestones and personal achievements. Nothing else matters, really. Everything is all personal. If you like a game, and are proud of it, then you have made a "good" game (In your belief). This obviously doesn't carry over to other people. Now, I think I've not answered the question. On the topic of "Rites of Passages", I personally have made several, for lack of terms, milestones. 1)Text-Game, 2)GUI Game (Buttons, text boxes, etc. No graphics), 3)2D Simple, as in controlling a person, graphics (Non-interactive tiles, top-down are simple!), etc 4) 2D Semi-Complex, by which I mean several different things happening at once. AI, Player, Bullets, Graphics, Sound, etc 5) Not determined! This is how I rate myself. I make a game of whatever "section" I am on, and go from there. I share with friends, ask for input, and program it to my liking. Anything else is moot, because if you aren't motivated to finish a "finished" project, then nothing will budge and it's done, because you like it as-is.
In general, programming (or coding) is what you make of it. If you are motivated, you can do pretty much anything with the right tools and experience (Plus advice, of course!). I believe that Edison is a perfect example in this case, "I have not failed 1000 times, but simply found out 1000 ways that it doesn't work." This occurs plenty of times in programming, where you're just throwing hands in the air and wondering why you even started this. Motivation, advice, and experience helps you power through this.
Now, I could probably turn this into an essay, but I hope that I've explained myself adequately and hope that I haven't missed something insanely obvious, or over-did anything. I'm still pretty self-conscious of these sorts of things, being such a wonderful social butterfly [/sarcasm].
-Ryan Newbie!
|
|
|
|
|
6
|
Games Center / WIP games, tools & toy projects / Re: My First Game, "Spaceshooter"
|
on: 2013-03-08 23:03:30
|
Oh, I didn't know that! I just that that the delta worked for the entirety of the program. I saw your post and was like, "Don't I have that in my run method?". But what your saying is that I should have, instead of i.e. "x += movespeed", I should change it to "x += movespeed * Game.delta" or somesuch? Also, thanks for the feedback and code scanning for me  !
|
|
|
|
|
7
|
Games Center / WIP games, tools & toy projects / Re: My First Game!
|
on: 2013-03-08 21:43:52
|
Hooray, got more stuff! Mostly front-end and pretty, but the code is being pretty lazy and disorganized (Not me, of course. It's the codes fault!) So, I'll give you the links and info and stuff: Sendspace Download Link V1.2(Alpha): http://www.sendspace.com/file/bq8b5oUpdate-Log: V1.2 (Alpha) [3/8/2013]: -Added a "Laser Bolt", deals 2 damage to enemies -Added enemy health -Limited Torpedos (1-shot kills, 5 total, 1 shot per second limiter) -Enemy ship graphics Todo: -Add a UI besides the "Debug" -User Options/Settings? -Levels/Stages -Clean and Organize code, big mess that it is. As usual, ideas, opinions, and feedback is much appreciated. I also commit all of my "Versions" and major changes to Github, which the link is the first post. Also, quick question, how do you think I should go about doing a store/UI? Opinions appreciated! Modify: Another question, any tips on how I'd turn this into a browser applet? Either I suck at Google, or I'm picking the wrong links =/
|
|
|
|
|
8
|
Games Center / WIP games, tools & toy projects / Re: My First Game!
|
on: 2013-03-06 02:40:09
|
|
Thanks for the feedback! Also, I wanted to thank specifically your suggestions and that your points are very good. I will start with saying that I should probably have not uploaded that picture in particular, it is slightly misleading. I've also got to ask, but did I forget to add the "readme" to the folder? I thought that I had written one up real quick and tossed that in with it. But anyways, if you wanted to see the "debug" info, it's F3. Hope I'm not going on too long, but thanks for the feedback. We certainly have a few things planned (If even for such a small game), and I hope that we manage to finish it to the point that we want it to be!
|
|
|
|
|
9
|
Games Center / WIP games, tools & toy projects / My First Game, "Spaceshooter"
|
on: 2013-03-06 02:10:20
|
Hello! I'm Ryan, and I've been working on my first "game" over the past weekend. After countless "projects" started, and forgotten along the highway, I've decided to scrap any and all ideas of being super-fancy, and I've settled into a sort of "Space Invader" sort of game. Very simple, just me and a friend or 2 working on a small project. Anyways, onto the actual game! I've titled it, quite elegantly, I might add, SpaceShooter! It was officially started Friday, March 1st, 2013. I just thought I'd do it myself over the weekend, almost like a personal game-jam. But my graphics sucked, my code was patchwork at best (Still is, actually!), and I didn't like it one bit. So, I rang up some friends on Skype, and got cracking. It was pretty much done by Sunday, but then we (Skype friends and I) got a fresh wave of ideas. So, I bring you, V1.0, the not-quite-Alpha version! Links Github (For the paranoid): https://github.com/RyanMB97/SideScroller.gitSendspace Download Link V1.0(InDev): http://www.sendspace.com/file/fdw674Sendspace Download Link V1.1(Alpha): http://www.sendspace.com/file/4nd9v5Sendspace Download Link V1.2(Alpha): http://www.sendspace.com/file/bq8b5oRealized that I never got around to creating a list of what we plan on doing! Here goes... - More Graphics (For enemies)
- Background music (Self-created) of the 8-bit kind
- Another/More weapon(s)
- Upgrades (Later on, after game is more polished, think "Beta")
- Sound effects in general
This is obviously not the complete list of ideas, or the final one. Hopefully we can manage to get most of these added. Open to suggestions! Update-Log:V1.2 (Alpha) [3/8/2013]:-Added a "Laser Bolt", deals 2 damage to enemies -Added enemy health -Limited Torpedos (1-shot kills, 5 total, 1 shot per second limiter) -Enemy ship graphics Todo:-Add a UI besides the "Debug" -User Options/Settings? -Levels/Stages -Clean and Organize code, big mess that it is. Ideas, Opinions, and General feedback is much appreciated! ImportantThere is a "Readme" file inside with controls and info, read it  ! Changed the Image [10:52PM 3/5/2013] [3:37PM 3/8/2013] 
|
|
|
|
|
12
|
Game Development / Newbie & Debugging Questions / Re: Need some minor help in fixing/implementing some code!
|
on: 2013-03-03 01:33:53
|
Right, sorry! My main problem is getting the collision to work. For some reason, the bullets will collide with 1 or 2 of the mobs, but not the others. The thing is, it should be checking against every single last one of the mobs/bullets for collisions. Here's the spot in focus: 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
| Iterator<Bullet> bulletIterator = bulletList.iterator(); Iterator<Mob> mobIterator = mobList.iterator();
while (bulletIterator.hasNext()) { Bullet bullet = bulletIterator.next(); bullet.tick(); if (!bullet.living) { bulletIterator.remove(); } }
while (mobIterator.hasNext()) { Mob mob = mobIterator.next(); mob.tick(); if (!mob.living) { mobIterator.remove(); } }
bulletIterator = bulletList.iterator(); mobIterator = mobList.iterator(); while (bulletIterator.hasNext()) { Bullet bullet = bulletIterator.next(); while (mobIterator.hasNext()) { Mob mob = mobIterator.next();
if (bullet.intersects(mob)) { mob.living = bullet.living = false; System.out.println("Intersection!"); }
if (!mob.living) { mobIterator.remove(); } } if (!bullet.living) { bulletIterator.remove(); } } |
Like I said, it's only colliding with some of the mobs that appear, and going completely through other mobs when it should be "Destroying" them.
|
|
|
|
|
13
|
Game Development / Newbie & Debugging Questions / Need some minor help in fixing/implementing some code!
|
on: 2013-03-03 01:27:52
|
Hello! I'm relatively new to the Java scene, but I've studied most of the important stuff, how it works, etc. This is my first "Game", as in with animations/sprites/what have you. I'm having a bit of trouble implementing my "kill mobs" style. In brief, I have a "bullet" arraylist (of bullet objects, obviously), and a mob arraylist. In my "tick" method, I have iterators that are ticking and checking for collisions. The ticking works, but the collision doesn't. Me and one of my friends have been puzzling over this the past day or 2, and we're no closer to finding out what's wrong. So, I thought of asking you guys for help! Here's the github link: https://github.com/RyanMB97/SideScroller.git and thanks in advance  P.S. The problem is in the "tick" method of "Game".
|
|
|
|
|
15
|
Game Development / Shared Code / Just a 2D Beginners code for sharing
|
on: 2012-03-27 01:29:21
|
Hello! I know I'm new and have only a few posts, but I wanted to be more active and post more, so I think i'll post some of my beginner/nub code! I've been coding in Java(General) for ~2 Months, and only beginning to get into 2D stuff more recently (Past 2 weeks or so). I've been following some 2D animating/coding tutorials, but they just don't make sense until I find some way to simplify and understand them. I like my code for reflecting simplicity. This will probably change though. Without further ado, here it is! Finding you Character (The most simple, focused AI I know of) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| public void findCharacter() { int xChar = 0; int yChar = 0; int xZombie = 0; int yZombie = 0; int moveSpeed = 1; if (xZombie < xChar) { xZombie += moveSpeed; } if (xZombie > xChar) { xZombie -= moveSpeed; } if (yZombie < yChar) { yZombie += moveSpeed; } if (yZombie < yChar) { yZombie += moveSpeed; } } |
There's also my Tile-Setter system  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| public void TileSystem() {
int Width = 640; int Height = 480; int x = 0; int y = 0;
int tileSize = 32; int rowTiles = 25; int columnTiles = 20; for (x = 0; x < Width; x += tileSize) { for (y = 0; y < Height; y += tileSize) { x = 0; } } System.out.println("X: " + x + "Y: " + y);
} |
//Note: I had to re-write this off the top of my head, since I didn't feel like going across the room to grab my flash-drive which I keep all of my good Java Tid-Bits on. I think I screwed up somewhere  After-Post #1 - Screwed up the tile-rendering thing. It's an infinity loop. I'll try to fix it while still working and then pastah back. Just some beginner's code! Hope I can develop a better organizational skill and also the ability to actually write this stuff better. 2D Animation is fun until you actually try to make it 
|
|
|
|
|
18
|
Java Game APIs & Engines / Java 2D / Painting problem & Creating more than 1 "enemy" -Fixed/Answered-
|
on: 2012-03-23 22:07:32
|
Hello! First off, I got this problem. I am currently using a drawLine to create a "laser". I have an "anchor-point" set up in the middle of my character (at the moment a box). Whenever I click, it shoots and when I release it goes back to the middle. However, if I move, it still points to my previous location from when I released the button. Here's the code: This was intended as a stop-gap to see if I could fix it. 1 2 3 4 5 6 7 8 9 10
| public void Shooting() { while (!SHOT) { xLaserDest = xLaserAnchor; yLaserDest = yLaserAnchor; } while (SHOT) { xLaserDest = xCoordinate; yLaserDest = yCoordinate; } } |
My MouseListener stuff: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| class Mouse extends MouseAdapter { @Override public void mousePressed(MouseEvent e) { int xCoordinate = e.getX(); int yCoordinate = e.getY(); xMouse = xCoordinate; yMouse = yCoordinate;
xLaserDest = xMouse; yLaserDest = yMouse;
SHOT = true; }
@Override public void mouseReleased(MouseEvent e) { xLaserDest = xChar + 16; yLaserDest = yChar + 16;
SHOT = false;
} } |
My "run" method: 1 2 3 4 5 6 7 8 9 10 11 12 13
| public void run() { try { while (true) { FPS.tick(); move(); zom.FindCharacter(); Thread.sleep(10); } } catch (Exception e) { System.out.println("Error"); }
} |
and finally my "Paint" and "PaintComponent" methods: 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
| public void paint(Graphics g) { dbImage = createImage(getWidth(), getHeight()); dbg = dbImage.getGraphics(); paintComponent(dbg); g.drawImage(dbImage, 0, 0, this);
}
public void paintComponent(Graphics g) {
xLaserAnchor = xChar + 16; yLaserAnchor = yChar + 16;
g.drawImage(backImage, 0, 0, this); g.drawImage(charImage, xChar, yChar, this); g.drawImage(zombieImage, zom.xZombie, zom.yZombie, this);
g.setColor(Color.YELLOW); g.setFont(font2); g.drawString(Controls, 90, 40);
g.drawString("MoveSpeed: " + moveSpeed, 480, 40);
g.setColor(Color.YELLOW); g.setFont(font); g.drawString("FPS: " + FPS.FPS, 5, 40);
g.setColor(Color.YELLOW); g.drawLine(xLaserAnchor, yLaserAnchor, xLaserDest, yLaserDest);
repaint(); } |
Another thing I want to do is create more than 1 "Zombie". I do not know how to do this at my current level, and Google hasn't helped much on this issue. If you could help me out here, I'd be eternally grateful  . Please don't hesitate to ask for my entire source-code, I really want to get this thing working  -Java Newbie, Ryan
|
|
|
|
|
20
|
Game Development / Newbie & Debugging Questions / Problem with creating multiple "Zombies"
|
on: 2012-03-20 02:12:20
|
Hello! This is my first post, so I hope that this goes well  ! Anyways, I am creating a mini-game to share with my friends. Not too big, just something to have fun with. My current problem is that I can only create 1 zombie, since my lack of experience forbids me from figuring this out, other then something about arrays, I have come to you! I hope you guys can help me  ! Pastebin linkage: http://pastebin.com/qqbAkbcEI will accept creative criticism, since that is a good way to learn. Also, please try to refrain from using some of the more "complex" methods, and stick to something I can understand/learn from right now. Thanks!
|
|
|
|
|
|
Add your game by posting it in the WIP section,
or publish it in Showcase.
The first screenshot will be displayed as a thumbnail.
|
|