collisions????

Non-platform specific questions.

collisions????

Postby amanuob » Mon Apr 26, 2010 10:28 am

how do this????
I want to activate a code when player collides with ground while its colliding with other objects,and when he jumps this code wont activated or when the player is not colliding with the ground?????
help please thanx in advance :)
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score

Re: collisions????

Postby Thanx » Mon Apr 26, 2010 2:18 pm

If I understand you well, you're trying to detect when the actor is colliding with several things at a time, and you also want events happening when he's not colliding with anyone.
So the answer is that when you use the oncollision event, then depending on what the actor is colliding with, it changes an integer's value to 1. ( someinteger = 1; )
and on the collisionfinish event it should change the integer's value to 0. Use the integer for no other collisions, nor any other purpose.
This should be done for collisions with anything you want to detect functionally.
Then create Draw Actor script editor event, where you start saying
Code: Select all
if(somefirstinteger == 1)
{
    //Do some actions while in collision
}
if(somefirstinteger == 0)
{
    //Do some actions while not in collision
}
if((somefirstinteger == 1) && (someotherinteger == 1))
{
    //Do something while colliding with both of those actors
}

Hope that helps and works...
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score

Re: collisions????

Postby amanuob » Mon Apr 26, 2010 10:22 pm

hehehe I'm having trouble with collision finish,
I put a collision finish command for testing, after a collision to the ground the commands moves the player to the right by 1 pixel, but when character stands on it keeps moving to the right Xd ???? so can you make a sample code or even a demo
thanx in advance. :)
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score

Re: collisions????

Postby Hblade » Tue Apr 27, 2010 2:46 am

Thanks for helping someone thanx :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: collisions????

Postby Thanx » Tue Apr 27, 2010 5:37 pm

I can make a demo through the week/end of the week, but then I need to understand what exactly you want to happen. Of what I understand, you want the character to move 1 pixel when it arrives on the ground, but no more. But the character keeps on standing, so the actors keep on colliding, though neither moves, therefore the 1 pixel movement continues.
Doing this requires a different approach, because what we want is still, that on collision, that variable should change to 1, and the collision finish action should also remain switching the variable back to 0.
So if you use the earlier approach for other actions, then keep those codes, but otherwise we're not going to need any of those codes for this solution. The reason is: if you only do this once when the actors start colliding, then to do this action simply add a collision event, and in the window for specification of which actor and what side of that actor you want the interaction with, you will also realize there's a "repeat this event while actor is colliding" set No by default. Keep that, and just simply add the someactor.x ++;
because that way it only does the action once, when they start colliding. Then if you want something to happen when the stop colliding, then use the collision finish event without anything special. So if I understand you well now, you will need no draw actors, or special variables, but that depends on what you want to do when...

Hope that helps, EVERYBODY is welcome! :wink: :lol:
Thanks, HBlade for doing the small correction in my post... I don't recall putting that code into the code brackets... :P
http://www.youtube.com/watch?v=XyXexDJBv58
http://www.youtube.com/watch?v=Be4__gww1xQ
These are me and playing the piano (second one with a friend/fellow student)
Hope you watch and enjoy!
User avatar
Thanx
 
Posts: 314
Joined: Sat Jan 26, 2008 10:07 pm
Location: Home sweet home! :)
Score: 24 Give a positive score

Re: collisions????

Postby amanuob » Wed Apr 28, 2010 12:07 am

:D..... thanx many a much....!!!! ok here we go
I want my player to change animation if he runs of a cliff that would be he's jumping animation.

I know how to make my player to change animation when he jumps but when I just run then fall of ex. an elevated ground hes animation is in running mode, I would like to change its animation directly to jumping
(that's why I'm asking about collision finish).
I sorta made a thing like this but its kinda glitchy and the animation is having errors and my player is hovering the object very weird (I've already deleted it).

if you wanna use my animation you can use this :).....
Attachments
Animation.rar
(25.24 KiB) Downloaded 59 times
Questions are necessary for the development of our own knowing, without questions How would we know??? and lesser would be my posts or none...therefore I know little or none.
User avatar
amanuob
 
Posts: 33
Joined: Sat Aug 29, 2009 11:47 am
Location: In Earth
Score: 1 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron