Game programming

Moderators: None (Apply to moderate this forum)
Number of threads: 2047
Number of posts: 5331

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Edit Report
help me please Posted by kerick on 23 Mar 2000 at 12:56 PM
I am making a game like Final Fantasy 1 in C and need some help.<br>
I am wondering how do I make a delay function that delays for any number of <br>
seconds I choose? and how do I put in sprites into my game.<br>
I am using djgpp and the allegro library.


Edit Report
Re: help me please Posted by Xotor on 23 Mar 2000 at 5:36 PM
: I am making a game like Final Fantasy 1 in C and need some help.<br>
: I am wondering how do I make a delay function that delays for any number of <br>
: seconds I choose? and how do I put in sprites into my game.<br>
: I am using djgpp and the allegro library.<br>
: <br>
<br>
Allegro has its own delay functions, use those.<br>
<br>
As for sprites, load the sprite into a BITMAP structure and blit it to the screen as a sprite.<br>
<br>
-Xotor-


Edit Report
Re: help me please Posted by Sagat on 24 Mar 2000 at 5:02 AM
: : I am making a game like Final Fantasy 1 in C and need some help.<br>
: : I am wondering how do I make a delay function that delays for any number of <br>
: : seconds I choose? and how do I put in sprites into my game.<br>
: : I am using djgpp and the allegro library.<br>
<br>
For delays, you can use the internal clock<br>
<br>
unsigned short *Clock = (unsigned short *)0x0000046CL; // Clock pointer<br>
<br>
void pause(int T) // Pause for clock ticks<br>
{<br>
unsigned short Now = *Clock;<br>
while (*Clock - Now < T) <br>
{<br>
// Do nothing<br>
}<br>
}<br>
<br>
Or wait for the vertical retrace<br>
<br>
void vr()<br>
{<br>
while ((inp(0x03DA) & 0x08)) {};<br>
while (!(inp(0x03DA) & 0x08)) {};<br>
}<br>
<br>
Sprites? Are you asking how to define a sprite<br>
struct or how to draw a sprite? Sprite struct<br>
should appear something like this<br>
<br>
typedef struct _Sprite<br>
{<br>
int X, Y, W, H;<br>
unsigned char *Image;<br>
char Palette[768]; // optional<br>
int Visible, Life, Power, Speed;<br>
} Sprite;<br>
<br>
To draw the sprite, load an image file into<br>
the Image -- don't feel like getting the code<br>
-- then use a draw bitmap type function<br>
<br>
DrawBitmap(MySprite->Image);


Edit Report
Re: Re: help me please Posted by Xotor on 25 Mar 2000 at 7:32 PM
However one problem is that the internal clock (I'm assuming PC clock) is too slow for most games.<br>
<br>
But if you're not timer-intesive then it will do just fine.<br>
<br>
-Xotor-<br>
<br>
: : : I am making a game like Final Fantasy 1 in C and need some help.<br>
: : : I am wondering how do I make a delay function that delays for any number of <br>
: : : seconds I choose? and how do I put in sprites into my game.<br>
: : : I am using djgpp and the allegro library.<br>
: <br>
: For delays, you can use the internal clock<br>
: <br>
: unsigned short *Clock = (unsigned short *)0x0000046CL; // Clock pointer<br>
: <br>
: void pause(int T) // Pause for clock ticks<br>
: {<br>
: unsigned short Now = *Clock;<br>
: while (*Clock - Now < T) <br>
: {<br>
: // Do nothing<br>
: }<br>
: }<br>
: <br>
: Or wait for the vertical retrace<br>
: <br>
: void vr()<br>
: {<br>
: while ((inp(0x03DA) & 0x08)) {};<br>
: while (!(inp(0x03DA) & 0x08)) {};<br>
: }<br>
: <br>
: Sprites? Are you asking how to define a sprite<br>
: struct or how to draw a sprite? Sprite struct<br>
: should appear something like this<br>
: <br>
: typedef struct _Sprite<br>
: {<br>
: int X, Y, W, H;<br>
: unsigned char *Image;<br>
: char Palette[768]; // optional<br>
: int Visible, Life, Power, Speed;<br>
: } Sprite;<br>
: <br>
: To draw the sprite, load an image file into<br>
: the Image -- don't feel like getting the code<br>
: -- then use a draw bitmap type function<br>
: <br>
: DrawBitmap(MySprite->Image);<br>
: <br>
<br>



Edit Report
Re: Re: help me please Posted by kerick on 28 Mar 2000 at 12:39 PM
how do you draw sprites?


Edit Report
Re: Re: Re: help me please Posted by Unknown on 30 Mar 2000 at 1:28 AM
how do you draw sprites?<br>
<br>
Allegro defines functions to delay the game and draw images... go figure.





 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.