From: Derek V. T. <De...@i-...> - 2002-03-22 12:03:45
|
I remember a few months ago we were telling *you* how to do this sort of thing, Will! You know you're getting somewhere when you start giving other people advice :) Nice job. Derek -----Original Message----- From: William labbett [mailto:w_l...@ho...] Sent: Friday, March 22, 2002 10:48 AM To: al...@ca... Subject: Re: [AL] How to do it? > Hi there. > > How to move a sprite from A to B ? > note: > A is a fixed position, B is the mouseX,Y position > right after button 1 pressed. > I would like to do something like do_line() but > the sprite will move on screen (I don't want a > continuos line!) You need to understand how the computer does what you're talking about.If you were to do /*psuedo*/ blit(small sprite to middle of buffer bitmap) blit(buffer to screen) /* then */ blit(small sprite a bit to the left of middle of buffer) blit(buffer to screen) you'll get your sprite drawn twice, the second time over the top of the first because the sprite you drew first time is still on the buffer bitmap when you draw it again. So what needs to be done before you move it is erase it from the buffer first, then it won't be there! So say your background was black then you need to blit a black rectangle the size of your sprite to the buffer.Then blit the sprite in it's new position.You could just clear the screen to black for simpler code but that wouldn't work if you wanted other things to stay were they were. I haven't used the mouse yet in allegro but I suspect your code would be something like; /* as part of loop */ /* pseudo*/ get_mouse_position(); clear_the_screen_to_black(); blit(sprite at mouse coordinates); if you want the sprite to appear centred on the mouse cursor (so the cursor's in the middle of the sprite when it's drawn) then you need to do a bit of maths; you need to draw the sprite half the width and height of itself closer to to 0,0. hope that helps Will >From <all...@ca...> Fri Mar 22 04:18:18 2002 Received: from smtp2.libero.it [193.70.192.52] by canvaslink.com with ESMTP (SMTPD32-6.00) id A6D924C001BA; Fri, 22 Mar 2002 04:18:17 -0500 Received: from lano (151.28.34.53) by smtp2.libero.it (6.5.015) id 3C99A710000C0AB4 for al...@ca...; Fri, 22 Mar 2002 10:12:50 +0100 Date: Fri, 22 Mar 2002 09:56:11 +0100 From: Lo'oRiS il Kabukimono <_l...@li...> To: al...@ca... Message-Id: <200...@li...> In-Reply-To: <5.0...@po...> References: <B14C9D7F1977D111AD740060970ACBDAD42902@warhol> <B14C9D7F1977D111AD740060970ACBDAD42902@warhol> <5.0...@po...> X-Mailer: Sylpheed version 0.7.4claws1 (GTK+ 1.2.10; i586-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8bit Subject: Re: [AL] A mouse question Precedence: bulk Sender: all...@ca... Reply-To: al...@ca... X-UIDL: 317035386 Status: O Content-Length: 328 Lines: 10 > I am just curious what does mouse_sprite point to?? > (it is in the mouse section of the help) it points to the mouse cursor. -- "When the world is in darkness, four warriors will come..." - Final Fantasy I . /\ ° Real Name: Lorenzo Petrone <* > Web: digilander.iol.it/lano666 \/ · >From <all...@ca...> Fri Mar 22 04:52:41 2002 Received: from mail12.svr.pol.co.uk [195.92.193.215] by canvaslink.com with ESMTP (SMTPD32-6.00) id AEE7272401BA; Fri, 22 Mar 2002 04:52:39 -0500 Received: from modem-145.eressea.dialup.pol.co.uk ([62.136.199.145] helo=6mml20j) by mail12.svr.pol.co.uk with smtp (Exim 3.35 #1) id 16oLdg-00027F-00 for al...@ca...; Fri, 22 Mar 2002 09:47:13 +0000 Message-ID: <000201c1d186$f5eda6a0$91c7883e@6mml20j> From: "DavidGreen" <da...@da...> To: <al...@ca...> Date: Fri, 22 Mar 2002 09:48:32 -0000 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_000F_01C1D186.BA58F720" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Subject: [AL] floods of unsolicited mail from allegro Precedence: bulk Sender: all...@ca... Reply-To: al...@ca... X-UIDL: 317035387 Status: O Content-Length: 1169 Lines: 34 This is a multi-part message in MIME format. ------=_NextPart_000_000F_01C1D186.BA58F720 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable dear allegro,I am being swamped with mail from canvas link = allegro.PLEASE .UNSUBSCRIBE ALLEGRO in the body of the message.I have = not requested it and I do not require it.am an old infirm person and can = do without all this hassle. ------=_NextPart_000_000F_01C1D186.BA58F720 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=3DContent-Type content=3D"text/html; = charset=3Diso-8859-1"> <META content=3D"MSHTML 5.50.4134.100" name=3DGENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=3D#ffffff> <DIV><FONT face=3DArial size=3D2>dear allegro,I am being swamped with = mail from=20 canvas link allegro.PLEASE .UNSUBSCRIBE ALLEGRO in the body of the = message.I=20 have not requested it and I do not require it.am an old infirm person = and can do=20 without all this hassle.</FONT></DIV></BODY></HTML> ------=_NextPart_000_000F_01C1D186.BA58F720-- |