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: Pick up and throw help with gm5/gm6  (Read 1404 times)

0 Members and 1 Guest are viewing this topic.
Pick up and throw help with gm5/gm6
« on: May 11, 2007, 01:55:59 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
I made my character be able to pick up and throw rocks,pot,bombs,etc.
But I have a problem...
everything he holds is about 8 pixels on top of his head...it looks like its flying.
the size of my character is 16x22 and I'm using mit's engine...the one that dlbrooks33 used on his engine too.
dlbrooks33 put this code:
Code: [Select]
with (holding_pot) {
    solid=0 // It no longer will get in our way
    solid=false // It no longer will get in our way
    depth=-2
    if (objLink.sprite_index=sprLinkLiftD or objLink.sprite_index=sprLinkLiftU or objLink.sprite_index=sprLinkLiftL or objLink.sprite_index=sprLinkLiftR){
        switch(global.facing){
            case "U": move_towards_point(objLink.x,objLink.y-(objLink.sprite_height-8),point_distance(x,y,objLink.x,objLink.y-(objLink.sprite_height-8))/2); break;
            case "D": move_towards_point(objLink.x,objLink.y-(objLink.sprite_height-8),point_distance(x,y,objLink.x,objLink.y-(objLink.sprite_height-8))/2); break;
            case "L": move_towards_point(objLink.x,objLink.y-(objLink.sprite_height-8),point_distance(x,y,objLink.x,objLink.y-(objLink.sprite_height-8))/2); break;
            case "R": move_towards_point(objLink.x,objLink.y-(objLink.sprite_height-8),point_distance(x,y,objLink.x,objLink.y-(objLink.sprite_height-8))/2); break;
        }
    }
    else{
        switch(global.facing){
            case "U": x=objLink.x;y=objLink.y-(objLink.sprite_height-8); break;
            case "L": x=objLink.x;y=objLink.y-(objLink.sprite_height-8); break;
            case "D": x=objLink.x;y=objLink.y-(objLink.sprite_height-8); break;
            case "R": x=objLink.x;y=objLink.y-(objLink.sprite_height-8); break;
        }
    }
}
With mit's code it always has a problem, with this one works but its way too far of his head.
what numbers do I need to change? o_0
Thanks in advance...
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: Pick up and throw help with gm5/gm6
« Reply #1 on: May 11, 2007, 03:12:57 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1635
I'll be honest - I really think the only way to make picking up, running with, and throwing objects look good is to change its position for each  image index, and you have to check for each sprite. It's just so variable and hard to really get it to match Link's walking - the only way to do it without so much manual finding positions is to get a sprite of a pot (or rock, or whatever) bobbing up and down (like Link is carrying it), but without Link.
Logged
Re: Pick up and throw help with gm5/gm6
« Reply #2 on: May 11, 2007, 03:42:08 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 121
that takes a lot of sprites so if you are good with timelines you could use those.
Logged
Re: Pick up and throw help with gm5/gm6
« Reply #3 on: May 11, 2007, 07:21:28 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 640
I had an idea dont know if it works so I want to ask you guys(since you are better than me with gm).
I'll use this same exact code, but I'll change and add some things.
I'll use a variable call "pickedobject=0"
lets say I pick up a rock.
then it'll be pickedobject=1
on the draw event of link I'll put something that draws a rock on top of him, and when he throws the object if he is facing up create the throw object with direction up, and so on.
the point is this: draw a sprite not an object on top of link, so it wont look like its flyng, would it work?

PS:If its pickedupobject=2 it'll draw a pot, if its 3 a bush and so on...
Logged
This is an english website, please speak it.
l0l wut? o_0
Re: Pick up and throw help with gm5/gm6
« Reply #4 on: August 21, 2007, 08:15:21 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
my old engine had a working pickup/throw engine
this isn't my code but someone else released this for free use

put this code in the object you want on top of links head
in the step event

objlink is your player object

this has !@#$% from my own engine but it will give you an object that moves with link
and doesn't look like its chasing/flying/jerking.

Code: [Select]
depth=objlink.depth - 1;
self.image_single = objlink.image_single
//global.currentaction = "throw"
if chucked = false
{x=objlink.x+1 y=objlink.y-15}
else
{
if distance_to_object(objlink) > 40
{
with self { instance_destroy() }
instance_create(x-5,y-16,objBomb)
}
}
« Last Edit: August 21, 2007, 08:17:26 pm by ClamyD »
Logged
Re: Pick up and throw help with gm5/gm6
« Reply #5 on: August 21, 2007, 08:29:41 pm »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1767
WHOA gravedig much, try not to do that ok?
Logged
  • https://colbydude.com
Re: Pick up and throw help with gm5/gm6
« Reply #6 on: August 21, 2007, 08:34:58 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
Sorry was searching this forum for advice/examples for a pickup and throw. Came across this thread and decided to add.
My bad.
Logged

Kremling

Re: Pick up and throw help with gm5/gm6
« Reply #7 on: August 26, 2007, 09:16:13 pm »
So are you using the actual object of the throw-able object? Or are you using the animation of when link picks up the item? :huh:
Logged
Pages: [1]   Go Up

 


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



Page created in 0.213 seconds with 51 queries.