Hi, I have a question about animation of objects. In my simple one screen game I have a main character that consist of 4 sprites. I want him to walk across the screen. I'm also going to have more objects with some animation. I was thinking to make an engine for general handling of all objects animation.
How are you guys doing this sort of thing? what data do you have in ROM/RAM? what is the structure of the data in ROM? how are you handling objects generally?
The following is what I have come up with so far.
In ROM the tiles that make up the object needs to be defined:
Somewhere in RAM each object need to have a place where the object is represented with an ID, adress to the frames in ROM and so on...
Is what I have described a smart or good approach. Do you have something better or smarter or easier way of doing animations, please share.
How are you guys doing this sort of thing? what data do you have in ROM/RAM? what is the structure of the data in ROM? how are you handling objects generally?
The following is what I have come up with so far.
In ROM the tiles that make up the object needs to be defined:
Code:
WalkLeft:
;frame1
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
;frame2
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
;frame3
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
WalkRight:
;frame1-3
... and so on
;frame1
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
;frame2
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
;frame3
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
.byte tile#, x-pos, y-pos, attr
WalkRight:
;frame1-3
... and so on
Somewhere in RAM each object need to have a place where the object is represented with an ID, adress to the frames in ROM and so on...
Is what I have described a smart or good approach. Do you have something better or smarter or easier way of doing animations, please share.