flat assembler
Message board for the users of flat assembler.

Index > Main > How to make an High Score ?

Author
Thread Post new topic Reply to topic
vanzan



Joined: 27 Apr 2010
Posts: 14
vanzan 08 Jun 2010, 06:52
For my IT games project (an ASCII Arkanoid in DOS 8086), I would like to add an High-Score fonctionnality...

But I've no idea how to do that... Indeed, I think that I had to use array in order to display it but I don't know how to manage the pseudo of the player (in order to associate the pseudo with his score...
Post 08 Jun 2010, 06:52
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 08 Jun 2010, 07:29
vanzan,

Ask player for his/her/its name, associate this name with corresponding entry in high-score table (if it exists). Update when game is over.
Post 08 Jun 2010, 07:29
View user's profile Send private message Reply with quote
vanzan



Joined: 27 Apr 2010
Posts: 14
vanzan 08 Jun 2010, 07:46
Ok, but I want to make a simple system like old school game.

Like this:
http://pocketnow.com/html/portal/reviews/0000000447/review/highscore.gif

I want to set the table to 10 entries. And insert the player's score in the table if it exceeds the minimum.

I know how to sort an array of numbers, but I do not know how to associate the nickname of each player to score in the tri ...

The 10 channels are set: should I make a second table for correspondence between the nicks and scores?
Post 08 Jun 2010, 07:46
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 08 Jun 2010, 08:30
vanzan,

There are many ways. You may add another array of pointers to player names where player_name[j] corresponds to high_score[j], or modify high-score table to be composed of struct { int high_score; char *player_name; }.
Post 08 Jun 2010, 08:30
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4335
Location: Now
edfed 08 Jun 2010, 10:21
IT VS ASCII Arkanoid in DOS 8086

ok, lets say that 8086 is a little obsolete.
Post 08 Jun 2010, 10:21
View user's profile Send private message Visit poster's website Reply with quote
vanzan



Joined: 27 Apr 2010
Posts: 14
vanzan 08 Jun 2010, 11:25
We aren't allowed of using MACRO (structure, if..end,...) :/
Post 08 Jun 2010, 11:25
View user's profile Send private message Reply with quote
baldr



Joined: 19 Mar 2008
Posts: 1651
baldr 08 Jun 2010, 12:36
vanzan,

Structure is a programming paradigm, you don't have to use language concepts (such as struc-macro) to implement it — especially in assembly language. Can you use symbolic constants (equ)?
Post 08 Jun 2010, 12:36
View user's profile Send private message Reply with quote
edfed



Joined: 20 Feb 2006
Posts: 4335
Location: Now
edfed 08 Jun 2010, 14:54
for structures, i use offset table.

Code:
item_model:
.param1=0 ;offset 0 in item
.param2=4 ;offset 4 in item
.param3=8 ;offset 8 in item
....
item dd 0,1,2
....
mov eax,[item+item_model.param1] ; mov eax,0
mov ebx,[item+item_model.param3] ; mov ebx,2
mov ecx,[item+item_model.param2] ;mov ecx,1

    


with that, you don't use macros.

But... learning assembly

Without macros
only on emu8086

is like learning C without .h
Post 08 Jun 2010, 14:54
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.