GameMaker: Studio

GameMaker: Studio

View Stats:
Fiktor074 May 28, 2015 @ 7:23am
Pick up and Throw objects
Hi, everybody.
I'm making overhead action game. But I need some help. How can I make obj_player to pick up objects throw to the enemies?
I did pick up but couldn't throw it.

(obj_player has 8 direction dioganal movement,without mouse)
< >
Showing 1-2 of 2 comments
When you release a key, create a condition that will check for when an object is picked up. We can let the computer check the global variable:
if global.ObjectPickedUp = "True"
{
In between the brackets, you can add a code or an action that will create a moving object. This will represent the object that you are trying to throw.
}

If you use the drag-and-drop interface, you can use the action Create Moving Instance. If you're using Game Maker code, you can use:
instance_create(self.x, self.y, ObjPickedUp);

If you use the 'instance create' code snippet, the Create Event for ObjPickedUp should have code or actions that will cause it to move. You should also make sure that the thrown object has friction with a value low enough that causes it to slow down enough. Adding friction can be done via drag-and drop or with this Game Maker code:
friction = 0.1;

If you need any in-depth assistance, I can advise you further through Steam chat.
Fiktor074 Jun 8, 2015 @ 11:30pm 
Thank you for your help, trying to follow your advice. I will let you know if something changes.
< >
Showing 1-2 of 2 comments
Per page: 1530 50

Date Posted: May 28, 2015 @ 7:23am
Posts: 2