Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.apple2.programmer > #435

Re: ideas for super mario bros?

Newsgroups comp.sys.apple2.programmer
Date 2012-08-30 09:15 -0700
References (1 earlier) <aa9d119a-f65e-401c-aa20-b7acba951219@googlegroups.com> <8a0a7a48-e956-4f4b-ad95-e2677a68767b@googlegroups.com> <94327602-28af-4fcf-81ae-62f5ceb836c3@googlegroups.com> <46024113-85e4-4981-9977-7416d940c3b9@googlegroups.com> <e05bcfbe-d0a2-4e55-9409-61493adce218@googlegroups.com>
Message-ID <d62d0dfb-4740-4d9a-bbfc-9158c19de110@googlegroups.com> (permalink)
Subject Re: ideas for super mario bros?
From aiiadict@gmail.com

Show all headers | View raw


On Wednesday, August 29, 2012 10:35:42 AM UTC-7, Antoine Vignau wrote:
> You should consider having several buffers:
> 
> - the one with the whole map
> 
> - the one with the region to display (a moving clipped background)
> 
> - another one with the animation steps (it will move like the previous one)
> 
> 
> 
> 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.
> 
> 
> 
> On Tinies or Blockade (despite the fact that there are no moves because everything is displayed on a single screen), there are different buffers:
> 
> - one for the background
> 
> - one for the objects
> 
> - one for the animation steps of each object
> 
> 
> 
> Separating the last two buffers is useful because it limits your sprite collision detection to comparing only few values. The ones from the objects buffer. That way you separate the view from the logic. Logic being the sprite collision detection and the view what you display on the monitor.
>

I think I understand this %90
 
> 
> Let's take a shortened example: my sprites have the index 1 to 5, each one with five steps of animation:
> 
> ob (object buffer) :01 XX XX 02 XX 03 XX 04 05
> 
> asb (animation step buffer): 01 XX XX 01 XX 01 XX 04 05
> 
> scd (sprite collision detection):
> 
>   x1, y1: indexes of Mario
> 
>   for x=0 to sizeof(ob)
> 
>     if x1=x then 
> 
>       if ob(y1) has an object then
> 
>         collision, life--, etc.
> 
>   next x
> 

ok, the psuedo code is not firing any neurons in my brain.  But then I looked at it more and commented it before I pushed POST.

>   MarioX, MarioY ; indexes of Mario
>   for x=0 to sizeof(ob) ; cycle through the object buffer
>     if MarioX=x then   ;compare MarioX to Xcoord of object in buffer
                          ;if MarioX = Xcoord of object, then: 
>       if ob(MarioY) has an object then ;
                          ;If Ycoord of Object matches MarioY coord THEN
>         collision, life--, etc. 
                          ;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 objects.

You cycle through the whole tile buffer, not caring about X,Y until you find an object.  Then switch to the animation frame# buffer, and you have FineX,Y coordinates (aka animation steps).  Collision is checked, comparing X of object to MarioX, then Y coord to MarioY.


 
> next cycle:
> 
> 01 XX XX 02 XX 03 XX 04 05 <= same sprites
> 
> 02 XX XX 01 XX 02 XX 02 03 <= animation steps updated

This is where I'm lost a bit, but I think it is because it was just a hypothetical 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 <= 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 steps would go from 0 to 6, or from 6 to 0.  7 Shifts for each shape.  An a shape 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 change direction in steps is if one enemy runs into the other.



> how to left-scroll?
> 
> 1st- how is my map buffer organized? by column or row?

column.

This is getting more interesting every day

Rich

Back to comp.sys.apple2.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

ideas for super mario bros? aiiadict@gmail.com - 2012-08-16 22:20 -0700
  Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-08-17 08:20 -0700
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-20 14:07 -0700
    Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-21 01:10 -0700
      Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-08-21 09:44 -0700
        Re: ideas for super mario bros? D Finnigan <dog_cow@macgui.com> - 2012-08-21 17:12 +0000
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-21 22:48 -0700
  Re: ideas for super mario bros? Egan Ford <datajerk@gmail.com> - 2012-08-22 08:34 -0600
    Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-22 09:49 -0700
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-23 16:59 -0700
    Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-28 20:24 -0700
      Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 07:55 -0700
        Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-08-29 10:35 -0700
          Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 13:03 -0700
          Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-08-29 16:07 -0700
          Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 18:04 -0700
            Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-08 09:03 -0700
              Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-09-09 14:21 -0700
          Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-30 09:15 -0700
          Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-09-02 13:10 -0700
            Re: ideas for super mario bros? BLuRry <brendan.robert@gmail.com> - 2012-09-02 14:30 -0700
              Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-03 17:02 -0700
            Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-03 10:02 -0700
              Re: ideas for super mario bros? Antoine Vignau <antoine.vignau@laposte.net> - 2012-09-03 14:30 -0700
      Re: ideas for super mario bros? aiiadict@gmail.com - 2012-09-05 15:50 -0700
  Re: ideas for super mario bros? aiiadict@gmail.com - 2012-08-29 07:59 -0700

csiph-web