delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/01/09/19:30:56

Message-ID: <006101be3bcb$fbcbf440$53f8c6c3@johans-dator>
From: "Johan Henriksson" <johan DOT he AT telia DOT com>
To: <djgpp AT delorie DOT com>
Subject: Re: making a snake grow
Date: Sat, 9 Jan 1999 13:31:26 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

from Johan Henriksson, Sweden    HTTP://come.to/jhewok  |
Primary mail: johan DOT he AT telia DOT com                  #UIN 12035895
Second: jhe75 AT hotmail DOT com    Third: johan_he AT yahoo DOT com
Leadprogrammer and FX-specialist at Real software
http://come.to/real_software
*************************************************************************
-----Original Message-----
From: Andrew R. Gillett <arganoid AT fatal-design DOT com>
Newsgroups: comp.os.msdos.djgpp
To: djgpp AT delorie DOT com <djgpp AT delorie DOT com>
Date: Saturday, January 09, 1999 10:09 PM
Subject: Re: making a snake grow


>In comp.os.msdos.djgpp, Ben Dowling wrote:
>> Hi,
>>
>> I am writing a game called wormies, it is a snake
>> clone, but I don't know how to make the snake
>> grow! Could any one help me?
>
>How far have you got with the game so far? Presumably you must have a
>variable which contains the length of the snake, otherwise how do you
>know how much snake to draw on the screen?
>
>--
>Andrew Gillett       http://argnet.fatal-design.com/      ICQ: See homepage
>"No mustard? You dare to insult me with a mustard-less pizza? You will die
> for this!" - Michelangelo, Starship Losers
>

Allright. Let's see if I can help you...

typedef struct snakepart
 {
 short int x,y,type;
 } snakepart;
snakepart snake[SNAKE_MAXLENGTH];

short int snake_length;

I'd say this is the easy approach. Draw snake[0->snake_lenght]. To make it
longer: snake_length++; To move the snake:
snake[itteration+1]=snake[itteration]; Then place snake[0] at the heads new
position. Not to hard.



- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019