Received: by 10.66.76.130 with SMTP id k2mr1068556paw.16.1346343360152; Thu, 30 Aug 2012 09:16:00 -0700 (PDT) Received: by 10.68.218.226 with SMTP id pj2mr1165305pbc.19.1346343360135; Thu, 30 Aug 2012 09:16:00 -0700 (PDT) Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!4no28762494pbn.1!news-out.google.com!a8ni103028966pbd.1!nntp.google.com!r4no5959914pbs.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.sys.apple2.programmer Date: Thu, 30 Aug 2012 09:15:59 -0700 (PDT) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=108.230.94.47; posting-account=5kmk9wkAAAB22-WWGK8UTn8vQ5c3EvdQ NNTP-Posting-Host: 108.230.94.47 References: <8a0a7a48-e956-4f4b-ad95-e2677a68767b@googlegroups.com> <94327602-28af-4fcf-81ae-62f5ceb836c3@googlegroups.com> <46024113-85e4-4981-9977-7416d940c3b9@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: ideas for super mario bros? From: aiiadict@gmail.com Injection-Date: Thu, 30 Aug 2012 16:16:00 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Xref: csiph.com comp.sys.apple2.programmer:435 On Wednesday, August 29, 2012 10:35:42 AM UTC-7, Antoine Vignau wrote: > You should consider having several buffers: >=20 > - the one with the whole map >=20 > - the one with the region to display (a moving clipped background) >=20 > - another one with the animation steps (it will move like the previous on= e) >=20 >=20 >=20 > If you have enough memory, consider having three buffers of the same size= and use an index (let's call it X) as the indicator to the first column to= display. >=20 >=20 >=20 > On Tinies or Blockade (despite the fact that there are no moves because e= verything is displayed on a single screen), there are different buffers: >=20 > - one for the background >=20 > - one for the objects >=20 > - one for the animation steps of each object >=20 >=20 >=20 > Separating the last two buffers is useful because it limits your sprite c= ollision detection to comparing only few values. The ones from the objects = buffer. That way you separate the view from the logic. Logic being the spri= te collision detection and the view what you display on the monitor. > I think I understand this %90 =20 >=20 > Let's take a shortened example: my sprites have the index 1 to 5, each on= e with five steps of animation: >=20 > ob (object buffer) :01 XX XX 02 XX 03 XX 04 05 >=20 > asb (animation step buffer): 01 XX XX 01 XX 01 XX 04 05 >=20 > scd (sprite collision detection): >=20 > x1, y1: indexes of Mario >=20 > for x=3D0 to sizeof(ob) >=20 > if x1=3Dx then=20 >=20 > if ob(y1) has an object then >=20 > collision, life--, etc. >=20 > next x >=20 ok, the psuedo code is not firing any neurons in my brain. But then I look= ed at it more and commented it before I pushed POST. > MarioX, MarioY ; indexes of Mario > for x=3D0 to sizeof(ob) ; cycle through the object buffer > if MarioX=3Dx then ;compare MarioX to Xcoord of object in buffer ;if MarioX =3D Xcoord of object, then:=20 > if ob(MarioY) has an object then ; ;If Ycoord of Object matches MarioY coord THEN > collision, life--, etc.=20 ;you have a collision > next x I think I see... Sprite animation buffer contains the current steps of any= animation going on screen. Including Mario and any enemies or animated ob= jects. You cycle through the whole tile buffer, not caring about X,Y until you fin= d an object. Then switch to the animation frame# buffer, and you have Fine= X,Y coordinates (aka animation steps). Collision is checked, comparing X o= f object to MarioX, then Y coord to MarioY. =20 > next cycle: >=20 > 01 XX XX 02 XX 03 XX 04 05 <=3D same sprites >=20 > 02 XX XX 01 XX 02 XX 02 03 <=3D animation steps updated This is where I'm lost a bit, but I think it is because it was just a hypot= hetical case... 01 XX XX 01 XX 01 XX 04 05 (is the old animation step buffer) 02 XX XX 01 XX 02 XX 02 03 <=3D animation steps updated Is there something controlling the sequence of animation steps, making them= jump around in values like this? Or just a quick post? My animation step= s would go from 0 to 6, or from 6 to 0. 7 Shifts for each shape. An a sha= pe will only change direction if hitting a brick, which are all aligned to = multiples of 7 on the screen. The only other reason an animation would cha= nge direction in steps is if one enemy runs into the other. > how to left-scroll? >=20 > 1st- how is my map buffer organized? by column or row? column. This is getting more interesting every day Rich