Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starting a fighting game
#29
Quote:
Code:
1. SCREEN 13
2. CLS
3.
4. DIM sprite(129, 251) AS INTEGER 'load up to 252 sprites here
5.
6.
7. OPEN "water.til" FOR BINARY AS #1
8.
9. 'LOAD THE IMAGE DATA
10.
11. length = LOF(1) - 768
12.
13. FOR ctr = 0 TO length / 258 - 1
14.  
15.   'hardcoding the height and width of the sprites to be 16x16
16.    sprite%(0, ctr) = 128  '16*8 (for whatever reason)
17.   sprite%(1, ctr) = 16
18.
19.    'Input the 256 bytes of data in pairs, thus only 128 loops
20.    FOR word = 2 TO 129
21.       GET #1, (ctr * 258) + (word * 2), temp%
22.       sprite%(word, ctr) = temp%
23.    NEXT
24.  
25.   'PUT the sprite on the screen (obviously remove this eventually)
26.    PUT (ctr * 18 + 1, 150), sprite(0, ctr), PSET
27. NEXT
28.
29. 'Just so we can see the palette
30. FOR a = 0 TO 255
32. PSET (a, 0), a
33. NEXT
34.
35.
36. 'LOAD IN THE PALETTE
37.
38. length = length + 1
39. DIM colorval AS LONG
40.
41. FOR col = 0 TO 255
44.    GET #1, length + (col * 3), R%
45.    GET #1, length + (col * 3) + 1, G%
46.    GET #1, length + (col * 3) + 2, B%
47.
48.    R% = R% AND 63
49.    G% = G% AND 63
50.    B% = B% AND 63
51.
52.    colorval& = R% + (G% * 256) + (B% * 65536)
53.
54.    PALETTE col, colorval&
55. NEXT

I'd like to say thank you before I begin with my post. Wiz, your the best. I mean I can't believe you actually sat down and wrote code for me. Second I'd like to apoligize for not replying right away. Don't take it as insult. It turned out I had quite a few tests, and project due today. I've been trying very hard to get back to qb but simply didn't manage. So thank you all for understanding and don't take think your posts went to waste for my long silence at the forums.

Now for my reply. I've ran the code and it's working perfectly. Theirs a palate that stretches across the top, and the images appear fine.

Sadly I didn't understand all of it. So I decided to number all the lines in your code wiz and try to ask very specific questions.


Line 3 - The Dim Statement

I know how the dim statement is used in arrays, and I thought before I had a general understanding of it. It has become aparent to me that I need further understanding in order to use properly all the time. The dim statement sets dimentions and in this case to (I assume) an array called sprite? What are the values for exactly, and how do they work?

I've created a maze program previously to this and it had a DIM sprite(1000) setting in it. I assumed it was the amount of pixels the sprite could be. The program would than take a shot of the sprite I drew using the LINE command, and store it into sprite. Is the logic here simular. Please clarify it for me.

Line 7 - The OPEN Command

In a previous program, I used the OPEN command in order to load a .txt file and save information onto it. The normal way of using it I suppose. In this case I see the WORD binary and it's used to load an image. I have a few questions here.

Can you use the OPEN command to load in any graphic or other file format? For example a gif, jpg, or an avi? If so how exactly do you display it? Perticularly an AVI (I've read it was possible). Not that this is my number one focus at the moment it would be something I'd like to learn more on.

Line 11 - I guess I'm just dumb

Well I'm sorry but I really don't understand this part. I know what LOF(1) is. Your taking the size of the image loaded and subtracting 768. I don't get it. Why do you subtract 768?

Line 13-17 - I don't understand the logic here

Next you've launched a for loop which I assume takes the sprites and loads them into the sprite array, am I right? Simple enough I understand the Get command, is used to store everything into that little array you dimentionalized earlier and Put of coarse displays the sprite saved in umm sprite(num1 ,num2 ). Once again what does the num1, and num2 stand for?

Next your setting, according to your comments, the width and height. I don't quite follow this logic here. If it should be 16x16. Then why would you set the first one to 128 (16*8). Now besides that point I don't quite understand this. Your setting all 0s to be the width, and all heights to be 1s. Obviously it works becuase the program ran perfectly and your a genious but I miss the logic here. So your setting things to certain numbers, and playing around with width and height in a way I really don't understand.


Line 20-24 - The important loop I assume

Before I go on, I didn't get the translation for your variables. What does ctr stand for and what does word stand for and imply.

Now umm I assume this loop does the importand work becuase it actually stores the sprites. I'll keep this short and simple, I don't understand the proccess.

I'm not going to ask the same question on the PUT command which is further down becuase it will probably be answered in part with the rest of them.

---------------------------------------------------

Now I've never played around with pallets before. Ever. I need someone to explain to me how the proccess works. What are palletes used for? How are they implented? And how the code in the end works?

---------------------------------------------------


I have to apolize for this extremly long post and my stupidity in the subject. I'm simply not aware and a little in experienced. I'm more than willing to learn. I want to learn. I need to learn. But someone please talk, for me to listen.

I love this community and when I one day move onto the next language I so wish this community follows.
·····································LINEAR INC·····································
Ø-----------------------------------------------------------------------O
From Problem to Solution - We take the shortest distance
Reply


Messages In This Thread
Starting a fighting game - by Kofman - 04-21-2003, 06:00 AM
Starting a fighting game - by LooseCaboose - 04-21-2003, 07:54 AM
Starting a fighting game - by Kofman - 04-21-2003, 07:35 PM
Starting a fighting game - by na_th_an - 04-21-2003, 10:37 PM
Starting a fighting game - by wizardlife - 04-22-2003, 01:39 AM
Starting a fighting game - by na_th_an - 04-22-2003, 02:28 AM
Starting a fighting game - by Kofman - 04-22-2003, 02:29 AM
Starting a fighting game - by na_th_an - 04-22-2003, 02:45 AM
Starting a fighting game - by Kofman - 04-22-2003, 02:52 AM
Starting a fighting game - by na_th_an - 04-22-2003, 02:55 AM
Starting a fighting game - by Kofman - 04-22-2003, 03:01 AM
Starting a fighting game - by wizardlife - 04-22-2003, 03:30 AM
Starting a fighting game - by Kofman - 04-22-2003, 03:33 AM
Starting a fighting game - by na_th_an - 04-22-2003, 05:40 AM
Starting a fighting game - by Kofman - 04-22-2003, 06:57 AM
Starting a fighting game - by wizardlife - 04-22-2003, 08:05 AM
Starting a fighting game - by Kofman - 04-23-2003, 03:56 AM
Starting a fighting game - by Kofman - 04-23-2003, 04:17 AM
Starting a fighting game - by Kofman - 04-23-2003, 04:23 AM
Starting a fighting game - by wizardlife - 04-23-2003, 06:11 AM
Starting a fighting game - by Kofman - 04-23-2003, 06:27 AM
Starting a fighting game - by wizardlife - 04-23-2003, 06:38 AM
Starting a fighting game - by wizardlife - 04-23-2003, 06:39 AM
Starting a fighting game - by Kofman - 04-23-2003, 07:32 AM
Starting a fighting game - by wizardlife - 04-23-2003, 08:16 AM
Starting a fighting game - by Rokkuman - 04-23-2003, 08:07 PM
Starting a fighting game - by wizardlife - 04-23-2003, 09:00 PM
Starting a fighting game - by Kofman - 04-26-2003, 09:05 AM
Starting a fighting game - by Kofman - 04-26-2003, 09:06 AM
Starting a fighting game - by wizardlife - 04-26-2003, 09:51 AM
Starting a fighting game - by Kofman - 04-26-2003, 07:41 PM
Starting a fighting game - by wizardlife - 04-26-2003, 09:33 PM
Starting a fighting game - by Kofman - 04-26-2003, 09:52 PM
Starting a fighting game - by Kofman - 05-08-2003, 10:11 PM
Starting a fighting game - by Kofman - 05-09-2003, 12:26 AM
Starting a fighting game - by wizardlife - 05-09-2003, 04:20 AM
Starting a fighting game - by Kofman - 05-09-2003, 04:37 AM
Starting a fighting game - by Kofman - 05-09-2003, 05:27 AM
Starting a fighting game - by na_th_an - 05-09-2003, 06:11 AM
Starting a fighting game - by Kofman - 05-09-2003, 06:44 AM
Starting a fighting game - by Kofman - 05-09-2003, 06:48 AM
Starting a fighting game - by wizardlife - 05-09-2003, 06:56 AM
Starting a fighting game - by Kofman - 05-09-2003, 09:10 AM
Starting a fighting game - by wizardlife - 05-10-2003, 12:01 AM
Starting a fighting game - by wizardlife - 05-10-2003, 12:20 AM
Starting a fighting game - by Kofman - 05-10-2003, 06:29 AM
Fascinating... - by Glenn - 05-10-2003, 06:53 AM
Re: Fascinating... - by wizardlife - 05-10-2003, 06:36 PM
Starting a fighting game - by Kofman - 05-11-2003, 12:17 AM
Starting a fighting game - by Kofman - 05-11-2003, 12:30 AM
Starting a fighting game - by wizardlife - 05-11-2003, 01:32 AM
Starting a fighting game - by Kofman - 05-11-2003, 02:52 AM
Starting a fighting game - by wizardlife - 05-11-2003, 03:52 AM
Starting a fighting game - by Kofman - 05-11-2003, 04:15 AM
Starting a fighting game - by Kofman - 05-11-2003, 04:24 AM
Starting a fighting game - by Kofman - 05-11-2003, 04:36 AM
How do I begin an animation engine - by Kofman - 05-11-2003, 04:41 AM
Starting a fighting game - by Kofman - 05-13-2003, 03:32 AM
Starting a fighting game - by na_th_an - 05-13-2003, 03:43 AM
Starting a fighting game - by Kofman - 05-13-2003, 04:57 AM
Possible answer... - by Glenn - 05-13-2003, 06:52 AM
Starting a fighting game - by na_th_an - 05-13-2003, 07:25 AM
Starting a fighting game - by wizardlife - 05-13-2003, 07:54 AM
Starting a fighting game - by na_th_an - 05-13-2003, 08:02 AM
Starting a fighting game - by wizardlife - 05-13-2003, 08:16 AM
Starting a fighting game - by Kofman - 05-14-2003, 05:35 AM
Did you see where... - by Glenn - 05-14-2003, 05:39 AM
Starting a fighting game - by na_th_an - 05-14-2003, 06:26 AM
I didn't see your other question... - by Glenn - 05-14-2003, 08:21 AM
Starting a fighting game - by Kofman - 05-19-2003, 02:05 AM
Starting a fighting game - by na_th_an - 05-19-2003, 04:53 AM
Starting a fighting game - by Kofman - 05-19-2003, 05:45 AM
Starting a fighting game - by na_th_an - 05-19-2003, 06:24 AM
Starting a fighting game - by toonski84 - 05-19-2003, 09:43 AM
Starting a fighting game - by na_th_an - 05-19-2003, 04:36 PM
Starting a fighting game - by Kofman - 05-19-2003, 05:10 PM
Starting a fighting game - by wizardlife - 05-20-2003, 04:05 AM
Starting a fighting game - by na_th_an - 05-20-2003, 06:17 AM
Starting a fighting game - by Kofman - 05-22-2003, 01:47 AM
Starting a fighting game - by Kofman - 05-22-2003, 03:35 AM
Starting a fighting game - by Kofman - 05-22-2003, 05:13 AM
Starting a fighting game - by Kofman - 05-22-2003, 06:07 AM
Starting a fighting game - by wizardlife - 05-22-2003, 06:41 AM
Starting a fighting game - by na_th_an - 05-22-2003, 07:06 AM
Starting a fighting game - by Kofman - 05-23-2003, 02:37 AM
Starting a fighting game - by Ninkazu - 05-23-2003, 02:40 AM
Starting a fighting game - by Kofman - 05-23-2003, 05:38 AM
Starting a fighting game - by Kofman - 05-25-2003, 12:27 AM
Starting a fighting game - by Kofman - 05-25-2003, 12:30 AM
Starting a fighting game - by na_th_an - 05-25-2003, 12:37 AM
Starting a fighting game - by Kofman - 05-25-2003, 12:57 AM
Starting a fighting game - by Kofman - 05-25-2003, 12:59 AM
Memory in real mode is accessed... - by Glenn - 05-25-2003, 03:48 AM
Starting a fighting game - by na_th_an - 05-25-2003, 04:59 AM
Starting a fighting game - by Kofman - 05-25-2003, 05:34 AM
Starting a fighting game - by na_th_an - 05-25-2003, 05:46 AM
No, Na_th_an,.. - by Glenn - 05-25-2003, 05:51 AM
Re: No, Na_th_an,.. - by na_th_an - 05-25-2003, 05:55 AM
Starting a fighting game - by na_th_an - 05-25-2003, 06:35 AM
Starting a fighting game - by na_th_an - 05-25-2003, 07:27 AM
Read what you just... - by Glenn - 05-25-2003, 07:57 AM
Starting a fighting game - by na_th_an - 05-25-2003, 06:29 PM
Starting a fighting game - by toonski84 - 05-25-2003, 08:47 PM
Starting a fighting game - by Kofman - 05-26-2003, 01:10 AM
Starting a fighting game - by na_th_an - 05-26-2003, 01:42 AM
Starting a fighting game - by Kofman - 05-27-2003, 05:43 AM
Starting a fighting game - by Ninkazu - 05-27-2003, 06:39 AM
Starting a fighting game - by na_th_an - 05-27-2003, 08:33 AM
Starting a fighting game - by LooseCaboose - 05-27-2003, 02:47 PM
Yes, we've been over that... :) - by Glenn - 05-27-2003, 10:20 PM
Starting a fighting game - by LooseCaboose - 05-28-2003, 03:27 AM
Starting a fighting game - by Rokkuman - 05-28-2003, 07:01 AM
Starting a fighting game - by Kofman - 05-28-2003, 07:15 AM
Starting a fighting game - by Kofman - 05-30-2003, 03:14 PM
Starting a fighting game - by Ninkazu - 05-30-2003, 04:29 PM
You only multiply by 8 in mode 13... - by Glenn - 05-30-2003, 06:44 PM
Starting a fighting game - by na_th_an - 05-30-2003, 07:57 PM
Starting a fighting game - by Kofman - 05-31-2003, 11:51 PM
Starting a fighting game - by Kofman - 06-03-2003, 06:18 AM
Starting a fighting game - by Kofman - 06-03-2003, 06:52 AM
Starting a fighting game - by na_th_an - 06-03-2003, 07:11 PM
Starting a fighting game - by Kofman - 06-04-2003, 04:11 AM
Starting a fighting game - by relsoft - 06-04-2003, 08:09 AM
Starting a fighting game - by na_th_an - 06-04-2003, 09:08 AM
Starting a fighting game - by Kofman - 06-04-2003, 03:27 PM
Neopaint loads PCX pictures just fine. - by Glenn - 06-04-2003, 03:34 PM
Starting a fighting game - by wizardlife - 06-04-2003, 09:22 PM
Starting a fighting game - by toonski84 - 06-05-2003, 12:26 AM
Starting a fighting game - by Kofman - 06-05-2003, 03:18 AM
Starting a fighting game - by Kofman - 06-05-2003, 04:16 AM
Starting a fighting game - by na_th_an - 06-05-2003, 09:21 AM
Starting a fighting game - by wizardlife - 06-08-2003, 06:19 AM
Starting a fighting game - by Kofman - 06-10-2003, 04:39 AM
Starting a fighting game - by ak00ma - 06-10-2003, 12:04 PM
Starting a fighting game - by na_th_an - 06-10-2003, 05:11 PM
Starting a fighting game - by Ninkazu - 06-10-2003, 05:11 PM
Starting a fighting game - by wizardlife - 06-10-2003, 08:26 PM
Starting a fighting game - by Piptol - 06-10-2003, 10:44 PM
Starting a fighting game - by Kofman - 06-11-2003, 01:05 AM
Starting a fighting game - by Rokkuman - 06-11-2003, 02:59 AM

Forum Jump:


Users browsing this thread: 3 Guest(s)