Collision problem

Game Editor comments and discussion.

Collision problem

Postby Clokio » Wed May 25, 2011 2:55 am

My first project. The collision happen, the sound play, but the collision player is not repealed (script). Can you check my .ged

Thanks.
Attachments
Arrow.ged
(23.11 KiB) Downloaded 79 times
Clokio
 
Posts: 229
Joined: Tue May 17, 2011 2:18 pm
Score: 32 Give a positive score

Re: Collision problem

Postby skydereign » Wed May 25, 2011 4:57 am

The problem is your keydown event is set to repeat. It uses xvelocity=3, so each frame you set xvelocity to 3, even though each frame of collision you set it to the opposite. So each frame it undos the collision event, which is why it doesn't look like it is repeating. It isn't clear how you want to handle slow down in the collisions, but if you are having a keydown event set to repeat, use this code instead of the xvelocity.
Code: Select all
x+=3;


And remove the keyup event setting xvelocity to 0.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Collision problem

Postby Clokio » Wed May 25, 2011 7:57 pm

Moon defender have the same code and it set to repeat. And when it touch a spike it goes the opposite direction.

How can I use repeat then?

------
I made that new game, the problem it's not the player moving but the object it run into.
Attachments
Arrow2.ged
(1.26 KiB) Downloaded 63 times
Clokio
 
Posts: 229
Joined: Tue May 17, 2011 2:18 pm
Score: 32 Give a positive score

Re: Collision problem

Postby skydereign » Thu May 26, 2011 6:58 am

You'll have to be more specific on how you want the wall to repel the player. Also in the collision script, you should be using collide.x-=30, and not x-=30. Do you want slowdown? Instant jumping to the position, and many other factors.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Collision problem

Postby Clokio » Thu May 26, 2011 3:56 pm

It's working.
As I set collision from any direction. Is there a way to know from where the collision is from and maybe a a code to bounce from where ever direction you bump in it.

Thanks
Clokio
 
Posts: 229
Joined: Tue May 17, 2011 2:18 pm
Score: 32 Give a positive score

Re: Collision problem

Postby savvy » Fri May 27, 2011 7:45 am

If you want a bounce effect, should you not use PhysicalResponse? set all the values to 1.0 and it will bounce with equal velocity to how It was before. If you want different things to happen depending on the side of the collider the. You need to use top bottom left and right collisions.
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest