Jump to content


Photo

Alpha problems?


  • Please log in to reply
7 replies to this topic

#1 redfid

redfid

    GMC Member

  • New Member
  • 33 posts
  • Version:Unknown

Posted 06 November 2010 - 03:51 PM

Hi, I'm making a Platform/Rpg game with Game Maker 8 Pro. I have a problem with my Level Up object because I wanna make it so when you level up it shows "Level Up". I got that part but the problem is I want to make it move up and down for a few seconds then disappear. Here's my code
y -=2
image_alpha -=.04
if image_alpha < 0
instance_destroy()
This makes it go up and slowly disappear
  • 0

#2 Docopoper

Docopoper

    You are observant!

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

Posted 06 November 2010 - 04:07 PM

try this:
You need to define the variable "dir" in the create event and set it to 0.
dir+=10
y=ystart+lengthdir_y(20,dir)
image_alpha-=0.04
if image_alpha<0
instance_destroy()


replace the 20 to make more pronounced movements and change dir to change the speed of them.
  • 0

#3 redfid

redfid

    GMC Member

  • New Member
  • 33 posts
  • Version:Unknown

Posted 06 November 2010 - 04:12 PM

try this:
You need to define the variable "dir" in the create event and set it to 0.

dir+=10
y=ystart+lengthdir_y(20,dir)
image_alpha-=0.04
if image_alpha<0
instance_destroy()


replace the 20 to make more pronounced movements and change dir to change the speed of them.

How do I make it bounce normally then after a few seconds, it starts disappearing?

Edited by redfid, 06 November 2010 - 04:17 PM.

  • 0

#4 Docopoper

Docopoper

    You are observant!

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

Posted 06 November 2010 - 04:42 PM

by bounce normally what do you mean?
the way I gave you or some other way?
  • 0

#5 redfid

redfid

    GMC Member

  • New Member
  • 33 posts
  • Version:Unknown

Posted 06 November 2010 - 04:44 PM

by bounce normally what do you mean?
the way I gave you or some other way?

I mean bounce like you told me but without disappearing but after like 2 seconds it starts to disappear. I think it has something to do with alarms.
  • 0

#6 Docopoper

Docopoper

    You are observant!

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

Posted 06 November 2010 - 05:18 PM

because you are just using alpha, you can just set the alpha higher than 1 in the create event, because an alpha of 2 is the same as 1.

if you want to do it differently though you can just create a variable called delay and set it to 60,
then subtract 1 from it each step and check if it is less than 0.
  • 0

#7 redfid

redfid

    GMC Member

  • New Member
  • 33 posts
  • Version:Unknown

Posted 06 November 2010 - 05:36 PM

because you are just using alpha, you can just set the alpha higher than 1 in the create event, because an alpha of 2 is the same as 1.

if you want to do it differently though you can just create a variable called delay and set it to 60,
then subtract 1 from it each step and check if it is less than 0.

Ok thanks it works but now I need to know how to make the level up object follow the player until it disappears.
instance_create(obj_playersword.x,obj_playersword.y-40,obj_levelup)
This creates it on top of the player's head but it doesn't follow him.
  • 0

#8 Docopoper

Docopoper

    You are observant!

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

Posted 06 November 2010 - 05:49 PM

put this in the step event (using ystart because y =ystart+the bounce)
x=obj_playersword.x
ystart=obj_playersword.y-40

Edited by Docopop.co.uk, 06 November 2010 - 05:50 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users