Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
5 registered members (AbrahamR, wdlmaster, 7th_zorro, dr_panther, 1 invisible), 764 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
score problem #305803
01/17/10 13:25
01/17/10 13:25
Joined: Dec 2009
Posts: 53
Vyshess Offline OP
Junior Member
Vyshess  Offline OP
Junior Member

Joined: Dec 2009
Posts: 53
Hi,
i wanted a simple score counter for my spaceship game. (a counter from "00 to 99")
But the code doesn`t works good. First problem is that every time i shoot down an enemy the counter count`s +2. But in the code i wrote "score_value += 1;". Why it counts too much?
The second problem is that the score counter stops at "08". After that, it doesn`t count anymore,but why?
(both codes are based on the AUM37)

Here is the code for the counter:
Code:
/////////////////////////////score_counter///////////////////////

font score_font_01 = <scorefont_01.tga>, 15, 15;


string score_str = "0";
string temp_str;

var score_value = 0;

text score_txt
{
	pos_x = 188;
	pos_y = 47;
	layer = 9;
	font = score_font_01;
	string = score_str;
	flags = visible;
}


starter compute_score()
{
while (1)
	{
		str_for_num(temp_str, score_value);  
		if (str_len(temp_str) == 1)
		{
			str_cpy(score_str, "0");
			str_cat(score_str, temp_str);
		}
		
		if (str_len(temp_str) == 2)
		{
			
			str_cat(score_str, temp_str);
		}
		
		wait (1);
	}
}



And thats the code for the enemy:
Code:
function destroy_drone()
{
	if(you.skill40 == 1234)
	{
	 score_value += 1;
	}
...



thx for help (and sorry for my bad english)

Re: score problem [Re: Vyshess] #305859
01/17/10 21:33
01/17/10 21:33
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Not enough code, important parts missing (when does destroy_drone() get executed, ...).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: score problem [Re: Superku] #305938
01/18/10 16:02
01/18/10 16:02
Joined: Dec 2009
Posts: 53
Vyshess Offline OP
Junior Member
Vyshess  Offline OP
Junior Member

Joined: Dec 2009
Posts: 53
what do you mean? the rest of the code from my enemy is identic with the destroy_asteroid code. the only difference between my and the code`s from the AUM37 are that in my game the counter has only two numbers and one destroied enemy should count +1.

Re: score problem [Re: Vyshess] #306168
01/20/10 09:32
01/20/10 09:32
Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
George Offline

Expert
George  Offline

Expert

Joined: Aug 2003
Posts: 2,011
Bucharest, Romania
function destroy_drone() is called twice, etc. Set the event to null as soon as the first collision has occurred.

Re: score problem [Re: George] #306574
01/23/10 10:03
01/23/10 10:03
Joined: Dec 2009
Posts: 53
Vyshess Offline OP
Junior Member
Vyshess  Offline OP
Junior Member

Joined: Dec 2009
Posts: 53
Thx george!! The "my.event=null" was in the wrong line. I put it befor the counting line an now it works perfect! smile


A8 Commercial
A5 Standart
---------------
created games: - Bomber Maniacs

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1