collision

Non-platform specific questions.

collision

Postby j2graves » Sun May 24, 2009 8:42 pm

I'm making a game that is a side scroller, but I have a problem:

I am trying to make the view follow the main actor, the character you play as, and at the same time, I'm trying to create some objects that are supposed to stay on certain points in the screen. for example; I have a health bar that is in the lower left conrner of the screen. the trouble I encounter is making these actors follow the main actor properly:

1. I tried making them child actors of the main actor, but the problem I faced was z-depth. they automatically recieve the same z-depth of the main actor no matter what I do, and I need the health bar to have a maximum z-depth at all times so that you can see it throughout the entire game.
2. I tried to solve this problem by adding an invisible center actor which is always following the main actor, but the problem I encounter is that now the health bar shakes every time the main actor collides with the ground.

someone suggested I get a better collision system. what do I do?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: collision

Postby makslane » Sun May 24, 2009 9:46 pm

Is better make the score, health bar, children of the view.
Game Editor is an open source game creator software that's wants to pay it's developers to keep evolving.
If you like Game Editor, make a review!
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score

Re: collision

Postby j2graves » Sun May 24, 2009 9:49 pm

even when I do it that way, I run into the same problems:

the zdepth inheritance, and the shaking on collision.
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: collision

Postby BlarghNRawr » Mon May 25, 2009 4:01 am

actorname.x=view.x;
actorname.y=view.y;

that way the actor only follows the view and not inherit the zdepth
Download Game Music
current projects:
Bold! ?% Started mechanics
Unnamed puzzle game 60% --i need a name!--
User avatar
BlarghNRawr
 
Posts: 767
Joined: Wed Jun 25, 2008 12:36 am
Location: Not using G-E anymore. Now using Source SDK.
Score: 27 Give a positive score

Re: collision

Postby j2graves » Mon May 25, 2009 2:34 pm

that's where the shaking comes in.
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: collision

Postby j2graves » Mon May 25, 2009 4:36 pm

I don't think you people are understanding;
If I use parent, the actors inherit the z-depth
if I use the x= method, the actors shake every time my main actor collides with the ground.
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: collision

Postby DST » Mon May 25, 2009 5:12 pm

I got ya j.

The shaking thing is hit and miss; some people experience it, some don't. In my smooth scrolling demo, it scrolls perfectly for some, and shakes for others. Not sure why.

And sometimes it shakes for me too, on other games where i tried using view.x=player.x. Try the smoothscrolling demo, and if it doesn't work, use Feral's child method - move the view to the bottom of the Z plane. If view has a Zdepth of 0, then all its children will have a normal Zdepth!
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: collision

Postby j2graves » Mon May 25, 2009 5:50 pm

thanx for your help. the fact is, that no matter what I do, I encounter at least one of these problems. someone told me that I sould get a better collision system. has anyone developed a good collision system that avoids shaking?
No games to my name...
User avatar
j2graves
 
Posts: 1302
Joined: Thu Aug 16, 2007 6:42 pm
Location: on the other side of infinity
Score: 19 Give a positive score

Re: collision

Postby DST » Mon May 25, 2009 7:36 pm

If you're referring to the collision with the ground, and you are using physical response, then yes, the player is constantly colliding with the ground (and shaking).

It's not the view that's shaking. Its the player.

What i do to avoid ground collision shaking is this:

Collision>top side>ground>repeat yes
Code: Select all
yvelocity=0;
PhysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);
 


A physical response with an Final Event Multiplier of 0, with a yvelocity of 0 = _______(fill in the blank)!
This leaves only the xvelocity of the physical response to deal with.

The problem with tiles and clones is that ge includes the corner pixels in its collisions (most engines handle corner pixels differently). this means that walking on top of a new tile also incurs collision with the side of the new tile.

So two methods to this are: 1. use a solid ground actor, not tiles or clones or
2. use a repeating colllision that gives you the effect you want every time. If you use a non repeating collision, there will be a difference between the frames where collision occurs and the frames where they don't (or a difference between when the response actually corrects velocity and when it doesn't need to.) If you want things to be smooth, they need to be constant.

The other things is - remember my perfect collision demo?(yeah, i know, not so perfect).

Well the main point i made there is that a shapechanging sprite will jiggle the physical response around. Try these methods with a solid block that doesn't animate. See if the shapechanging is the problem.

Much of platform physics can be based on yvelocity - for instance, resetting canjump when a player falls - just disable canjump anytime yvelocity is over 2. When he's falling, he can't jump. I use 2 because....lol....the yvelocity incurred in the physical responses can fool it! Usually it doesn't go over one but sometimes it does. 2 is safe, if the gravity is (yvelocity+=1) then each frame picks up 1 velocity, and its only 2 frames to jump disable, so it appears instantaneous.

The question you're asking is simpler than this thread makes it seem. We're saying different things but using the same words (or vice versa) - its difficult for each of us to understand what the other is saying, i guess.

I went thru this before many times, i know exactly what your problem is, but there are many ways around it. There are many ways around any problem.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron