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: Quick Lives Problem  (Read 880 times)

0 Members and 1 Guest are viewing this topic.
Quick Lives Problem
« on: July 26, 2007, 03:02:03 am »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1767
ok I'm working on making lives for a game. The lives work, BUT the images don't. The room starts and the sprite remains and image 0 when it should start at 3. Then when you die it still doesn't change, and the lives do go down. Can anyone help? Here's what I have so far

Sprites:

{spr_lives}
image 0: a zero
image 1: a one
image 2: a two
image 3: a three

The Lives Controller Object:
{obj_lives}
<Create Event>
Code: [Select]
image_index=spr_lives
lives=3
image_speed=0
<Step Event>
Code: [Select]
if lives=0{
show_message("GAME OVER!")
game_restart()}
<Draw Event>
Code: [Select]
draw_sprite(spr_lives,-1,view_xview+0,view_yview+72)
code for when the character dies:
{obj_health}
<Step Event>
Code: [Select]
if obj_health.image_index=0{
lives-=1
show_message("You DEAD!")
obj_health.image_index=34
room_restart()}

If anything else needs to be explained let me know.

PS: For my healthbar object I'm using images as health with 0 as none and 34 as the max.
Logged
  • https://colbydude.com
Re: Quick Lives Problem
« Reply #1 on: July 26, 2007, 01:11:01 pm »
  • All Hail Crappy Sprites!
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 34
Hmm, I don't know if 7 works the same as GM 6.1 but I had a look and I think I worked it out:

all this is a code edit for the Lives object

<Create>
Remove the first line, it isn't needed.

<Draw>
Change it so it looks like below:
Code: [Select]
draw_sprite(spr_lives,lives,view_xview+0,view_yview+72)If you can't see it, I changed the -1 for subimg to lives, so the subimg (image 0,1,2,etc) is equal to the amount of lives

hope it helps you!
Logged
~Project List~
-Untitled RPG - Barely Started!
Re: Quick Lives Problem
« Reply #2 on: July 26, 2007, 04:24:40 pm »
  • *
  • Reputation: +2/-0
  • Offline Offline
  • Gender: Male
  • Posts: 1767
Holy crap dude I can't believe I missed something as simple as that! Thanks a lot Cookie. *Locked*
Logged
  • https://colbydude.com
Pages: [1]   Go Up

 


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



Page created in 0.065 seconds with 41 queries.

anything