Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (702)
Games in Android Showcase (203)
games submitted by our members
Games in WIP (774)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 ... 4 5 [6] 7 8 ... 10
 51 
 on: 2016-12-06 00:13:48 
Started by bmanmcfly - Last post by VoidBuffer
I'm having a hard time understanding exactly what you would be using tweens for, especially when you mention that you want to apply tween to movement. My understanding of tweens is the manipulation of sprites and effects such as your example of a sprite flashing, not necessarily physics. If you need something to handle physics and angles, you could try and look into Box2D physics which could make your life easier, or maybe even just apply your own collision. As far as tweens go, I feel you can get away with using Actors or Shaders in order to apply effects to your character. All in all I feel it just depends on your approach to how you want to make things like cut scenes. For cut scenes in games, I've seen developers directly manipulate the velocity/position of their models. For example a warcraft cut scene where your character is being controlled, or even in the classic mario brother games when you win a level and he jumps on the flag at the end. Alternatively the larger studio games actually have amazing cinematic scenes that overlap the real game screen, like world of craft and many others... It just depends on how you want to do it.

Just to answer you question, yes an Actor will use a Stage which can be used on a Screen. If you are using Sprites with Spritebatch, then you'll be familiar with having to use spritebatch.begin()/end(). Actors and their Stage object are just like a Sprite/batch with their batch object, but they just offer more features. Check out this post: http://stackoverflow.com/questions/10619394/when-to-use-actors-in-libgdx-what-are-cons-and-pros

Here is my personal example of my main game Screen, which is by no means a definitive go-to guide. I just feel it's helpful to show a different approach to different problems:

Actors - I use them for my in-game UI, because I like applying effects/actions to certain UI buttons. It's as easy to make Actors and have them part of a Stage, because all you need to do is just put that stage into your render() method, and run it. Going deeper, I add my Actors to a Table, which helps me organize my UI so that it's easy to align on my screen. It also helps with resolution scaling because I'm making a desktop game, and my Table will automatically re-scale the properties of all my UI depending on the resolution.

Sprites - I use these for my player/enemy entities. Since I'm making a 2D game, I can get away with simply rotating my sprites when I'm changing direction, and you can swap textures of those sprites with other textures if you want to emulate some sort of complex animation(Or just use 2D Particle Editor).

Shaders - You can use shaders for different types of transition/color effects. This is applied to mostly my sprites, but I already try and make my own solutions before I may use shaders.

 52 
 on: 2016-12-05 23:18:12 
Started by mike_bike_kite - Last post by bmanmcfly
@bmanmcfly - 1 - I suspect it's a little late to rewrite the games using a games library, I'm not sure I'd enjoy writing the games that way either though that's a personal preference. 2- Is there no way of transferring the Graphic thing into an image and then resizing that. I'll admit it doesn't sound to performant but as long as I can get ~30 FPS I'd be happy. 3- Regards darkening the screen, would you know how to grab the graphics object into an image that I can then play with? 4- Regards images, I'm quite happy drawing but my problem is I can't work out what to draw that might fit into the game - it's set on a frozen world with cartoon style graphics, ice mountains in the background, snow falling and bubbles to shoot that float through the mist. The bombs I have currently look good and tell you that it's not a good thing running into them. The problem is that spherical bombs with fuses are unlikely to be found in space games.

@darkening - thanks for the example code but can I ask what video is?

I wish I could offer better knowledge on this...

1 - I understand that feeling, especially when it comes to the realization that you'd have to rewrite a significant amount of code, etc...  There was a point when I felt the same way (I was writing c++ for directX, and realized that android / ios games was more realistic and achievable for me), I just went for the engine because then I wouldn't be starting over from scratch... that said, I do understand your desire to make a system for yourself, where you know how everything works with everything else.

2 - I wouldn't know a good way how to accomplish that, a strategy I might try might be something to the effect of, when the program starts, do a detection of the screen size and resolution, and then have a variety of the sprite sheets to handle some of the more common resolutions and then use that data to determine which assets to load...  others probably will have better suggestions.

3- I'm not sure myself, I do know with the "sprite" class that libgdx offers, you can get the image and directly manipulate the alpha and other aspects of the image.... might be useful to check out the source they use to accomplish that.  Otherwise, I'm afraid I'm little help here too.

4- Just throwing this out there, have you considered changing from the old school cartoon bomb to something like the ww2 era sea mines (they look like a sphere with a bunch of needles sticking out)??
I mean, that might still be unlikely in a space game, but it might be a bit less of an inconsistency.... 

alternatively, if you change it to something that looks more like a missile, or bomb dropped from a plane, maybe with a blinking light to signify 'danger'? 

There's no real right or wrong here.

 53 
 on: 2016-12-05 22:34:45 
Started by mike_bike_kite - Last post by Archive
video is the pixel array that you want to draw to.

 54 
 on: 2016-12-05 22:00:32 
Started by mike_bike_kite - Last post by mike_bike_kite
@bmanmcfly - I suspect it's a little late to rewrite the games using a games library, I'm not sure I'd enjoy writing the games that way either though that's a personal preference. Is there no way of transferring the Graphic thing into an image and then resizing that. I'll admit it doesn't sound to performant but as long as I can get ~30 FPS I'd be happy. Regards darkening the screen, would you know how to grab the graphics object into an image that I can then play with? Regards images, I'm quite happy drawing but my problem is I can't work out what to draw that might fit into the game - it's set on a frozen world with cartoon style graphics, ice mountains in the background, snow falling and bubbles to shoot that float through the mist. The bombs I have currently look good and tell you that it's not a good thing running into them. The problem is that spherical bombs with fuses are unlikely to be found in space games.

@darkening - thanks for the example code but can I ask what video is?

 55 
 on: 2016-12-05 21:40:51 
Started by SteveSmith - Last post by bmanmcfly
When I had been playing around with box2d, that was around the point where I had to go through the process of doing the "fix your timestep" thing...

The only other thing that I could think of (keep in mind of limited experience), perhaps the scale is not being set properly?  That was one of the first issues I came across when playing with box2d was ensuring that the scale was adequate... although, if the results are normal on a faster computer, this might not be the right solution, but it could be the factor of each pixel being treated as 1meter.


 56 
 on: 2016-12-05 20:52:24 
Started by SteveSmith - Last post by SteveSmith
Hi all,

I've just been messing about with JBox2D, and it seems pretty great.  The only problem I have is getting an app to run at a constant speed when run on different PCs.  It runs fine on a fast PC, but slow on a slower PC.  Do I need to throttle the game loop like you would in any other game, or does it do that automatically?  E.g. is the following okay:-

1  
2  
3  
 while (true) {
            world.step(timeStep, velocityIterations, positionIterations);
 }


or should it be more like:

1  
2  
3  
4  
 while (true) {
            world.step(timeStep, velocityIterations, positionIterations);
            Thread.sleep(1000/fps);
 }


And do I need to tweak the params I'm passing to World.step(), ie. timeStep, velocityIterations, and positionIterations, for better performance?

Thanks in advance!


EDIT: By looking at the testbed examples, I've seen that the latter is correct.  However, my own app seems to run very slow.  I've got a gravity of (0, -10) and I've created a ball with a density of 10,000.  However, it still takes about 10 seconds to drop 600.

 57 
 on: 2016-12-05 20:42:28 
Started by wessles - Last post by Opiop
I asked a while back if I can include pictures I've taken in this thread, seems like I forgot! Here's a couple I've taken over the last few months. I have lots more but these are the only ones I have on my phone that are easily accessible.

First one was taken in some forest somewhere. Nothing too crazy, but I like the textures. I also did some editing by turning the photo B&W, then scrubbing the color of the concrete back in.


I like this one because of the difference between the materials used to construct the buildings. The light in the back is "haloing" a little bit unfortunately, the post-editing really brought it out too much.


This one, I haven't done much in post yet because I can't figure out what to do with it. I love the colors in it, but the shelf the trees are sitting on lines up with the edge of the photo weird and it drives me crazy. I wish I could retake this picture and spend more than 5 seconds lining it up!


Again, love the colors in this picture. The sky really stands out against the stairs, although I might have turned up the saturation to really play that effect out  Tongue


I was helping my cousin move when we may have gotten the UHaul stuck... new neighbor to the rescue! This wasn't actually taken on my DSLR, but I think the moment is too hilarious/wacky to not share.

 58 
 on: 2016-12-05 19:52:00 
Started by bornander - Last post by bornander
It may sound weird, but I somehow feel that the home-, x- and play button are too "edgy". They just don't look very smooth according to my eyes (Sorry, I'm a petty person). About the fancy part, I would just try to change the color a bit. Maybe some orange/red to still stand out from the level enviroment.
I haven't done anything to make the buttons less sharp, but I changed the look of them to this;
Click to Play


Aside from pointing out irrelevant things no one else probably cares about, I found a few bugs:
  • In the 4th world (pink alien) level 5 and 6 are exactly the same
  • My game crashes when I want to start the last level in the last world(yellow alien)
Thank you for pointing these out, they are fixed and a new version is available in Google Play soon.

I created a new level for the Pink level 5, it's will be called STAMPLER'S LEVEL as you were the one finding the problem Smiley

 59 
 on: 2016-12-05 19:49:21 
Started by ziozio - Last post by ndnwarrior15
Is this for a game?

In all my years of gaming I just can't think of a scenario where a ton of screen space was needed for inputting text. And it's not like I'm interested in writing a novel anyways, I want to play the game.

I would set a maximum capacity for the text based upon the dialog window where the text is going and how much text I plan to fit inside there. Even if the text overflows and scrolling is required, there is only so many characters that will need to be printed to the screen at any given time.

I just changed my maximum sprite capacity from 1000 to 10,000 and notice barely any difference in memory allocation. This is all just my own opinion and how I would end up doing things but I don't see why making an empty larger VBO is such a big deal. My performance in the game (FPS) didn't change nor did memory space suffer from making a larger VBO. Plus I wouldn't plan on running around shooting blowing up a thousand things while having tons of english characters dancing on my screen anyways.

 60 
 on: 2016-12-05 19:45:00 
Started by bmanmcfly - Last post by bmanmcfly
Are you talking about the Universal Tween Engine(aurelienribon), or the built in tween engine within libgdx(Interpolation)? Either way I personally haven't come across a use case for either yet that wasn't something I could have easily done myself or through Actors. In your example of using tweening for screen's, this is something you could achieve with the built in Actors which have Actions. For example I use Actor.Actions in order to fade/move/rotate various entities. For example the fading effect on my splash screen is simply:

1  
splashImage.addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(FADE_TIME), Actions.delay(FADE_TIME)));


So you can get away with a lot in terms of just using the Actors within LibGDX without having to worry about using a tween engine.

For your second question, this really just depends on how you want to approach your design. I don't personally use tweens for player movement, but instead move a player around by their Vector2 position, which is variable of Vector2 velocity. From there I can modify the players position by adjusting their position.x and position.y, likewise with velocity. If your moving via velocity, you can add that to your position data as such:

1  
position.add(velocity.cpy().scl(Gdx.graphics.getDeltaTime() * SPEED)); // Updating position of player


I hope that helps Smiley This post was a bit broad so I kind of pulled out my shotgun and spray fired a little.

Thanks for the response.

Yes, I was referring to the universal tween engine.  I have used the "interpolation" class for other things, like the camera class so that it's not keeping the player pixel perfect in the center of the screen...

In the general sense, I have the player controls working (but incomplete), and I had the thought that it might simplify matters if I could change things so that instead of calculating speed and having a damping to slow down or whatever, that I could just interpolate the speed... 

I put the question up because I had reservations about heading down another rabbit trail, like what I wound up doing because I was adamant that  I wanted to have slopes in a platformer (had to learn SAT algorithm, figuring out way points between terrain transitions, etc... probably cost me several months in what little time I do spend coding)...

Your suggestion about using speed and position vectors to handle motion, that's what I've got setup as it is...

So, my player update is effectively :
- if airborne: calculate X part of the speed vector, calculate Y part of speed vector
- if grounded: check the direction of the terrain, calculate the speed on the terrain, scaled to the direction
- check collisions for the desired position
- adjust speed if needed and move to the new position.

So, at this point in particular, it's not so much of an issue of a "need" to add in the tween engine for controls, I just had the idea that using tweens might simplify controls, but even overnight in starting the setup of integrating tweens into the controls, I'm starting to see some potential problems (things like transitioning from one tween to the next)... I could still see some uses for it, like if the player is hurt would make the player flashing to show invulnerability....  anyway.

You do raise a different question, I hope that I ask it the right way to be most pertinent :

If you are using actors, doesn't that involve using a stage and all that?  Or can that be made to work with the screens?

While, I intend to look into this a bit deeper, it is starting to look like just manipulating vectors is the easiest approach anyway, though I think I will use the tween engine for periods where the player does not have control over the character... like in interlude sections, or where story is being developed.  Too bad I still need to get the player controls complete first before I start worrying about issues like 'movie sequences'...




Pages: 1 ... 4 5 [6] 7 8 ... 10
 
Lunch (52 views)
2016-12-06 16:01:40

ral0r2 (279 views)
2016-11-23 16:08:26

ClaasJG (412 views)
2016-11-10 17:36:32

CoffeeChemist (505 views)
2016-11-05 00:46:53

jay4842 (552 views)
2016-11-01 19:04:52

theagentd (577 views)
2016-10-24 17:51:53

theagentd (558 views)
2016-10-24 17:50:08

theagentd (507 views)
2016-10-24 17:43:15

CommanderKeith (502 views)
2016-10-22 15:22:05

Roquen (463 views)
2016-10-22 01:57:43
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!