timgranstrom

Members
  • Content count

    26
  • Joined

  • Last visited

Community Reputation

718 Good

About timgranstrom

  • Rank
    Member
  1. as Cmac said, you should avoid using physics for this sort of thing imo. So some thoughts etc: Raycasting uses the physics engine to shoot "rays" that collide with objects (this requires that all object have colliders, otherwise you won't and hits and hence no data from the hits) I feel that what you want to do isn't really that much about physics or more complex movements at all. I would say this is more a matter of animations. What I mean is that to trigger that sort of attack-combo etc, it is more a matter of triggering animations when a certain combination of buttons are pressed and some conditions are met (such as enemy is within attack range). You don't really need to use physics in this type of game because it doesn't try to implement realism in the game (Stay up in air for 10 seconds while performing attacks isn't really realistic). You could still use some physics for basic collissions and triggers though. Fun fact: Why you feel that the physics in unity is similar to box2D is actually because Unity implements Box2D for it's 2D physics (Box2D is arguably the most popular 2d physics library out there). Finally: I would recommend you to get accustomed to using Unity first, learn about animations and how to trigger them, try using collission and raycasting for different triggers and to "attach" the character to the ground when he isn't jumping etc. Good luck!
  2. 2d game lagging.

    Alright, if no one else experiences it then it's definitely related to something local on us computer. Hope you find the culprit :)
  3. 2d game lagging.

    Off the top of my head I would say it's not Java related in the sense that Java needs to be reinstalled, since rotmg is created in flash. I would probably try to reinstall the graphics drivers, maybe something went wrong during an update. Edit: If this doesn't work, maybe you should make sure that you are clearing the memory in the game so that you don't just continuously allocate more and more memory just because u aren't flushing/clearing ur graphics after each redraw or something like that. Otherwise I think we need more information, when exactly did it start, what's the difference between the code when it worked and the week that didn't work etc. What did you add? Without this it's extremely difficult to give an accurate answer.
  4. When to Implement Game Loop

    A game loop can be thought of as the core of a game. Pro's why you would want to try using a game loop in your game: For learning purposes. Thats really all the reason you need! Generally a game loop handles 3 parts: initializing the game,updating and drawing. Even though you don't really need this in your text game, it's a nice way to learn the basics I guess. Basics as in, learning how to set the speed of the cycle, aka fps(frames per second) and ups (updates per second). I'm not sure how your game is constructed but chances are that you will need to edit some stuff or the entire game to get it working. But if you wanna learn how it works then go ahead and implement it! Generally I would say that the first thing you should always do is implement a game loop. Good luck! psst, a little example about how your gameloop would probably look (in psuedo code):   gameLoop() { init(); // Initialize while(gameIsRunning) { input(); update(); render(); } clearMemory(); // clear/empty allocated memory. } As you see, it does not need to differ much from the game loop of a graphical game
  5. Best Game Engine for java?

    I would definitely recommend libgdx for java. It's a nice api that offers a lot of functionality. Naturally you'll need to learn how it works and I dunno how much experience you have with actual game development, however, I do think it's a good start to use libgdx nonetheless. There are lots of tutorials available for beginners. As to using flash for the animations, I'm not sure about how you'll handle that part within libgdx. I'm sure there are ways, but you could just split the animations up into a sprite sheet and animate it from there using a texture atlas. Alternatively you can buy spine2D and use it for animations(fantastic software). As I said, it all depends on your experience. Also, a little friendly advice: Dunno if you've developed before, but when you start using a new api or develop your first games, don't try and overdo it! There's quite a lot of learning and programming to be done before you get some results, taking on to big of a challenge in the beginning can be discuraging! I would definitely throw out a few simple games before starting on anything larger. I'm saying this because you used the term business/dev partner Hope I was of some help! Cheers and good luck! :)
  6. Thank you for this, we're doing an algorithm course at my university atm and this is exactly what we're learning about, however, I find your examples and explanations much more easy to understand. You're a life saver!
  7. drag and drop menus

    your gonna need to be more specific then that! are you asking how to check if the item your dropping has been dragged outside the menu window? Then yes, you could simply do a position check when you drop your item. If it's outside the window then it will return a boolean to that specific item and handle it accordingly. (i.e. remove the item from an array in the menu) But thats just one way to do it, it all depends on the menu your making and the effect you want to achieve
  8. Pong v2

    yes I was thinking of doing something similar like that!   Though I'm probably gonna use an ArrayList instead since it is faster and newer then vectors   thanks for the feedback!   ------------EDIT---------   I was thinking of doing this but then realised that this would result in many extra checks in the updates etc because of the for-loops etc!   Am I wrong about this? I was mainly thinking this since the update method will have to access the objects aswell.
  9.   I see, that seems reasonable!   Okay I've edited the collision so that it uses instanceof.   Though the collision is sometimes a bit buggy, for example: if the ball hits the top or bottom edge of the paddles it kinda goes into it and bounces inside until it gets out haha..   Not sure how to stop this though!
  10. I see, it's just that I read somewhere that (and I semi-quote it) "If you need to use instanceof, it means your code is bad/needs improvement" and many agreed on what that person said. I dunno though how true it is and I don't remember if it was in game-development or general programing (as these are different in my opinion). What do you think?   Yes I normaly use that, but for some reason the program didn't like it. It might have been a bug though, I'm gonna try again :)   I will do that, thanks! :)
  11. this won't work since it checks for everything and it just really freaks out haha..   I found a "solution" to this problem though, but I'm not sure it's a good one or not..   in the Entity Class, I made another variable. protected String entityName; //The name of an entity This works so that if you want to, you can give your entity object a name for various reasons.   then in the ball,paddle and ai class, I add their entity names in their constructors like this: this.entityName = "Paddle"; and so on.   Then the collision detection in their update methods looks like this:     ball: //If there is an obstacle if(obstacle != null) { if(obstacle.entityName == "Paddle") { this.invGoingLeft(); } if(obstacle.entityName == "Wall") { this.invGoingDown(); } } paddle and ai are identical in the collision detection: if(obstacle != null) { if(obstacle.entityName == "Wall") { if(obstacle.getY() < getY()){ this.collideDown = false; this.collideUp = true; } else { this.collideDown = true; this.collideUp = false; } } if(obstacle.entityName != "Wall"){ this.collideDown = false; this.collideUp = false; } }     Is this a good way or would this be considered a bad way to check what it collides with?   I get that in more advanced games where there are more objects and factors etc this would probably be a bad way.   But what about in this game?
  12. I'am having one issue with this..   I'm not sure how to make the entities respond correctly..   for example: when I check the ball, if it collides with a wall above it, then the balls Y-direction should change, and if it collides with the wall below it should also change Y-direction. Now this I can do. but the problem is that it also has to check if it collides to the left or right and in that case it has to invert the X-direction!   Now thats a bigger problem.. because then returning "true" or "false" won't cut it in the collision method...
  13. It's simple, you can use Entity as the base class. Entity is anything that has a position,a size and is renderable in the game. Then for your "living things" you can create a MovingEntity class which extends from Entity. Now with that, all your entities/obstacles descend from Entity.   Entity.java --------------------------- public class Entity { int position x; int position y; int width; int height; //Here go your getters/setters and contructors }   MovableEntity.java --------------------------------------- public class MovableEntity extends Entity { int speed; //Here goes your setters/getters/constructors public void update() { //Detect collision and move } } Now your walls can now extends from Entity or directly be directly a Entity. Your ball/paddle/ai can extends from MovableEntity or be directly a MovableEntity. hmm thats brilliant!   I'm gonna try to implement this tomorrow or so! I'll post here if I bump into any issues! Thank you :)
  14.   The problem with this is that the obstacle class i another abstract class that I made for objects that does not have "life" as in moving etc, they are static. such as Walls. While the entity class is supposed to be for Entities such as "living things" that are moving, etc!   I'm not sure as to how I should handle this issue..   Other then that, it's kind of brilliant! It took me a while to figure out what the code meant(it's kinda "late" here and I've been up since 5AM). But it sounds really good and I'm definitely gonna try to implement this!   Thank you :)
  15. I've already got an Update method in each entity, that updates their current position. I don't have one in my obstacles (wall) since they are not supposed to move, hence no need to update the x and y coords.   But the problem is, I'am not sure HOW I should implement it etc..