Jump to content

Photo

Best practices in Action!, mirror players?

action pmg

1 reply to this topic

#1 gozar ONLINE  

gozar

    Dragonstomper

  • 971 posts
  • Location:Ohio

Posted Fri Jan 3, 2014 2:18 PM

I'm working on writing my first game in Action!. It's a two player game, and the players are identical except that they are mirrored. I'm storing the shape data in a BYTE ARRAY, is there a trick to flipping my player?



#2 Rybags OFFLINE  

Rybags

    Gridrunner

  • 16,021 posts
  • Location:Australia

Posted Fri Jan 3, 2014 7:44 PM

In terms of speed it's probably the quickest, in terms of memory not the best but 256 bytes + the programming requirement isn't much.

 

Essentially you just use the original data as an index into the array, then store the looked up array entry into the graphics for the object.

A more memory efficient way is to just use a 16 byte table and operate on each nybble at a time.

But the saving isn't quite as much as you'd think as it's extra programming and execution time, so a 256 byte table is probably best by far.

 

So, your lookup table would look like (index, entry) - first 4 and last 4 in hex:

00 00
01 80
02 40
03 C0
..
FC 3F
FD BF
FE 7F
FF FF






Also tagged with one or more of these keywords: action, pmg

0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users