Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - TioMOG

Pages: [1]
1
Graphics / Re: [Help] An Isometric Movement Code
« on: October 27, 2014, 03:15:54 am »
Sorry, but you missunderstood me. I have wrote several codes, and worked with several alternative logics. All I want from here is for a "light" to understand how to deal with the "sprite-changing problem". I really don't want a code just to copy it, since I'm working on this project for educational matters.

It's like this: I had a acceleration functionable code, working as the physic's logic. My problem was that my sprite don't rotate, it only changes the sprite's frame when a key Up or Down is pressed. I deal the rotation considerating that instance's frame as the angle the car. The deal with it was that when the player presses the key "Up" or "Down", the method that changes the sprite is active as long as the key is pressed, so the top-speed for that position of the frame doesn't change and the car will continue to speed like it haven't change the sprite, like a "drift". I'm okay with the car drifting, since it do it too in the original game, but my car drifts for as long as the key is pressed, resulting in cases when it is facing right and still moving left.
I tried to do a code that once the keys "Up" and "Down" are pressed when the "Ctrl" is pressed it would deaccelerate, but, for some reason I still don't know, it haven't work.
Right now I'm looking on this drifting code to see if I can reduce the drift time, that would considerably helps me to find a realistic movement.

2
Graphics / [Help] An Isometric Movement Code
« on: October 26, 2014, 09:34:22 pm »
Hey, guys!

You guys helped me in the last topic I made for a help in collision for my isometric race game (this one), and I thank you very much :D

But now I'm getting stuck by this one problem, that is implementing a acceleration factor in my game. The main problem is that, as it is an Isometric game, the "speed+acceleration" and "speed+deacceleration" aren't enough to create a smooth functional moviment.
My code, for now, it's like this:

This is the code to acelerate:
(click to show/hide)

This is the code to swith the sprite's frame (The spritesheet is attached to the topic, for a better interpretation):
(click to show/hide)

And here's a simpler code that I was using to represent the moviment, but without an acceleration factor:
(click to show/hide)

My game is based on an 90's race SNES game, Rock n' Roll Racing, so, the movement I'm trying to implement looks like .

My problem resides in two problems:
1. The acceleration is different for the X axis and the Y axis at the same time, as for the velocity varies from a negative top-speed to a positive top-speed (since the moviment is in 360º).
2. When my car rotates, the velocity in both axis have to change, but not in the same way (and I can't use a simple rotate method, since my car it's a spritesheet, and rotate it can bug the graphic).

My car rotate from the keys "Up" and "Down", and it's movement is triggered by the "Ctrl" key.
I've tried doing the basic "when speed is lower than tospeed, accelerate", but when the car changes the frame, it changes the top-speed, leading the car to keep the velocity equals to the top-speed of the frame that it was when the acceleration began.

I would be very grateful if you guys could help me trough this :)
Thanks, seeya o/

3
If you're concerned is that entities will fail to collide with a shape of zero width, then yes you are correct, but it's still entirely possible to slip through a "1 pixel" rectangle if they're moving fast enough (and maybe they aren't, I don't know).  In this particular case, what you probably want to do is write your collision code not to detect collisions with the barrier itself, but rather detect any entity that has gone beyond the barrier, or perhaps detect collisions with the areas enclosed by the barriers.

P.S. In the general case this is deceptively tricky since any variations in the framerate can change what size objects do and don't collide.  This is the problem that fixed timesteps solve.

I am studying the possibility of doing a area for colision from a certain distance before the track borders. Since I'm dealing my cars as bounding boxes (they're close to the box format), I could make this so the car still can touches the border (not a big concern at the moment, actually).
For a superficial look, Simple Collision Detection for SFML 2 could be a solution to this case, once I could make a rectangle and rotate it 30º so it aligns with the limits that I want and work as a linestrip.

Just for the record, I'm not looking for a perfect collision system, I just don't want my cars to trespass the race circuit. My game is basically a remake of Rock 'n Roll Racing with some little improvements.

There's some others approuchs you could recommend for me to see what's better fits in my needs?

4
Yeah, I was talking about the sf::VertexArray method.

But if the primitive it's a Linestrip, what would be the height of that rectangle?
Since it's a straight line, it would be a widthx1 px rectangle?

Ps: I will look this example. Seems pretty nice

5
Well, hello guys! My first post, here :P

So, I'm doing a racing game for a college project and I'm planning on do a Isometric race track.

The problem is, when the track is created, I don't want to my car to walk on it's borders like Jesus or something like this, so I was thinking if it's possible to make a collision check with sf::VertexArrays?

Because I already have the tracks on the game (I did it like a tilemap), but it's impossible to make a tilemap collision, once the tiles are big, isometric and cover the ground and the border of the track. I saw the "getBounds()" method on the class, but I don't know what it returns in case of linestrip.

So, I would apreciate if you guys could help me to do a border with linestrip or give me better ways of doing this issue with another class/fuction, like ConvexShape or whatever :)

For a better explanation, I attached 2 files:
The first one it's the map as it is (Don't complain about it's quality, I know it's lame, but I'll improve it :P)
The second one it's the map, divided by it's tiles and with a YELLOW LINESTRIP, that could represent my idea of "Borders" that the car can't trespass;

Obs: Sorry about the bad english, it is not my native language
Obs: I have a car SpriteSheet example, if you guys need it :)

Pages: [1]