Jump to content


Photo

Reverting a scaled object back to original size


  • Please log in to reply
4 replies to this topic

#1 Freeload

Freeload

    GMC Member

  • GMC Member
  • 542 posts
  • Version:GM:Studio

Posted 25 May 2012 - 11:53 PM

Hi guys,

If I have an object that I've scaled down multiple times during a collision even, using image_xscale += -0.1 and image_yscale += -0.1, what do I use to get it back to it's original size.

I've tried setting image_xscale = 1 and image_yscale = 1 which I thought would do the trick but that doesn't seem to work for some reason.

Cheers,

Kirk
  • 0

#2 ChefDavid22

ChefDavid22

    No, YOU shut up!

  • GMC Member
  • 1193 posts
  • Version:GM:Studio

Posted 26 May 2012 - 12:12 AM

Create:
donescaling = 0

Step:
if donescaling= 0
{
image_xscale+=.10;
image_yscale+=.10;
}

if image_xscale > .99
{
donescaling = 1
}

This makes it grow. - you could also just do:

Create:
image_xscale=1;
image_yscale=1;

Edited by ChefDavid22, 26 May 2012 - 01:22 AM.

  • 0

#3 dannyjenn

dannyjenn

    GMC Member

  • GMC Member
  • 2074 posts
  • Version:Mac

Posted 26 May 2012 - 04:55 AM

you could also just do:

Create:
image_xscale=1;
image_yscale=1;

Not the create... he's trying to change the scale of an existing object (or at least that's how it sounds to me) so the create event would be pointless. It needs to go somewhere else... but he said that he has tried that and it doesn't work.

That being said... no idea why it doesn't work. Either it is working but you're just not seeing it (have you checked it in the debugger?) or it is not working because of some other code that you have. Without knowing your code then I can only make guesses...
- maybe that piece of code is in the wrong location, preventing it from being executed (for example, in an if statement that is never reached)
- maybe you have some code somewhere which is scaling it down again as soon as you reset the scaling
- if you're using a Draw Event... maybe you're accidentally drawing its scale at a value other than Game Maker's built in variable
- maybe you're accidentally reseting the scale on the wrong object
  • 0

#4 ChefDavid22

ChefDavid22

    No, YOU shut up!

  • GMC Member
  • 1193 posts
  • Version:GM:Studio

Posted 26 May 2012 - 12:44 PM

Right, typo. You'd put it in the step event and create a var when you want it triggered like I did with donescaling= 0.
  • 0

#5 Freeload

Freeload

    GMC Member

  • GMC Member
  • 542 posts
  • Version:GM:Studio

Posted 26 May 2012 - 05:09 PM

Hey guys,

I think I got this working.

I've been out all day so can't remember what I did to fix it but I don't think there was a problem with image_xscale = 1 and image_yscale = 1, just what I was doing around it maybe.

Cheers for the feedback.

Kirk

Edited by Freeload, 26 May 2012 - 05:15 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users