Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: help(GM6):pickup object following character  (Read 988 times)

0 Members and 1 Guest are viewing this topic.
help(GM6):pickup object following character
« on: January 25, 2007, 12:03:00 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 448
When I pickup an object and try to run with it, the object cant keep up with the player. Heres the position code in the step event of the pickedup object.

if (held){
    x = object939.x;
    y = object939.y-10+alteration;
    depth = object939.depth-1;
}

Alteration is the direction in which to throw(will probably get around to changing to the global direction). Ive kind of been blowing this off because the pickup/throw works near to perfect, but I'm at the stage to where I need to get it done. Any takers?
Logged

Dayjo

shut the fuck up donny.
Re: help(GM6):pickup object following character
« Reply #1 on: January 25, 2007, 12:22:23 am »
  • hungry..
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3602
What exactly does it look like? I mean.. like what do you mean by "keep up". If you mean it slightly lags, you might need to put something like this in the draw event;

Code: [Select]
if(held){
  draw_sprite(sprite_index,image_index,object939.x,object939.y);
}
else{
  draw_sprite(sprite_index,image_index,x,y);
}
Logged
  • My Blog

Goodnight

Once and future Captain
Re: help(GM6):pickup object following character
« Reply #2 on: January 25, 2007, 12:43:45 am »
  • With a Capital G
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 706
Try putting it in the End Step event so that it always happens after the player has moved.

Also I'd recommend you do:
x = object939.x;
y = object939.y;


Because don't forget, the object is really meant to be "above" the character, like in a true overhead game it would be coming out of your screen towards you. But because of the game's viewpoint, it only looks like its y should be lower. If you actually lower the y, then when it's thrown it could collide with things that aren't really in its path.

To make it appear higher but keep the object mask at the proper y, do this in the Draw event:
draw_sprite(sprite_index, -1, x, y-10+alteration);
Logged
Re: help(GM6):pickup object following character
« Reply #3 on: January 25, 2007, 01:47:16 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 448
Ah, thank you Goodnight, your the best ;)*locked*
Logged
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.201 seconds with 45 queries.

anything