|
« Reply #6 on: August 23, 2008, 06:43:25 pm »
|
|
I don't know if it's still hosted, but Yoshi had a pretty good one I think. I'm assuming this is in Game Maker. http://www.zfgc.com/forum/index.php?topic=3363.0 <- The topic. But what Min was saying was to have a variable such as: global.rupees=0; Then, when you collide with the rupee object, it should increase it by one and destroy the rupee object: global.rupees+=1; instance_destroy() If you want to know how to DRAW the rupees on screen, that's a different problem. Here's what I did, I'm sure there is better ways out there though. //This draws the little rupee icon that is in the corner of the screen draw_sprite(spr_rupee_rupee,0,view_xview[0]+8,view_yview[0]+240-16);
//if you have no rupees, it will draw three zeros. You can change this depending on wallet size or whatever. if global.rupees=0 { draw_text(view_xview[0]+19,view_yview[0]+240-14,'000',); } //if you have less than 10 rupees, but more than 1, it will draw two zeros, plus the amount of rupees you have. //And etc. if global.rupees>0 { if (global.rupees<10) { draw_text(view_xview[0]+19,view_yview[0]+240-14,'00'+string(global.rupees)); } else if (global.rupees<99 || global.rupees=99) { draw_text(view_xview[0]+19,view_yview[0]+240-14,'0'+string(global.rupees)); } else { draw_text(view_xview[0]+19,view_yview[0]+240-14,string(global.rupees)); } }
if (global.rupees=global.rupeeMax) { draw_text(view_xview[0]+19,view_yview[0]+240-14,global.rupees); }
Try that. I haven't used any of this for a while, so I'm a little rusty, and like I said, this isn't the best way to do it. Make sure you familiarize yourself with actually learning what variables are, and not just when to use them, but also HOW and WHY they work. Then you can actually code without examples and tutorials as guides.
Logged
|
Grimace is the demiurge, the creator. From him all things in McDonaldland have sprung. He is not a sin, he's not a menu item, he's just Grimace. He exists. He rolls his lidless eyes and flaps his lipless mouth, formless and terrible, a protean idiot thing from the depths of pre-history.
|