Push/pull boxes.

Game Editor comments and discussion.

Push/pull boxes.

Postby Grynde » Fri May 10, 2013 1:48 am

Greetings all. I have been able to answer most of my questions perusing the tuts and threads, however, I am at a loss in figuring out how best to allow my character to push/pull a box.

Initially, I tried collision (which allows me to push but no pull).

Feeling smart, I then attempted to change the parent with a button down command. But that allows me to grab the box from anywhere on screen.

I imagine it is a hybrid of the 2 concepts, but I will take any and all advice you guys are willing to throw my way.

Cheers.
Playing a game is the voluntary attempt to overcome unnecessary obstacles.
-Bernard Suits
User avatar
Grynde
 
Posts: 21
Joined: Fri Apr 26, 2013 12:41 pm
Location: Virginia
Score: 1 Give a positive score

Re: Push/pull boxes.

Postby Hblade » Fri May 10, 2013 2:11 am

Do the button but only on collision using:
Code: Select all
char*key=GetKeyState();
if(key[KEY_SPACE]==1)
{
 change parent
}
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: Push/pull boxes.

Postby Grynde » Fri May 10, 2013 6:16 pm

Thank you Hblade.

All is working properly (in that regard at least) :wink:

Once I knew what was going on, I added a release as well.
Code: Select all
    char*key=GetKeyState();
    if(key[KEY_s]==1)
    {
     ChangeParent("Collide Actor", "Event Actor");
    }
    char*key=GetKeyState();
    if(key[KEY_s]==0)
    {
     ChangeParent("Collide Actor", "(none)");
    }

Playing a game is the voluntary attempt to overcome unnecessary obstacles.
-Bernard Suits
User avatar
Grynde
 
Posts: 21
Joined: Fri Apr 26, 2013 12:41 pm
Location: Virginia
Score: 1 Give a positive score

Re: Push/pull boxes.

Postby Hblade » Fri May 10, 2013 11:55 pm

No need for 2 char*keys :) Just the top one
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: Push/pull boxes.

Postby Grynde » Sat May 11, 2013 1:00 am

Fantastic. Thanks so much.
Playing a game is the voluntary attempt to overcome unnecessary obstacles.
-Bernard Suits
User avatar
Grynde
 
Posts: 21
Joined: Fri Apr 26, 2013 12:41 pm
Location: Virginia
Score: 1 Give a positive score

Re: Push/pull boxes.

Postby Hblade » Sat May 11, 2013 7:14 am

Your welcome =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


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest