This is the code that I have sent to my university, which I consider as an unfinished code that I will work on when I have the chance to do it: It destroys the initial sprite sheet (in my personal opinion). I don’t think you want to have reSize for charImage in setup(). (or only one array and using different groups in it, like indexes 0 to 6, 7 to 12, 13 to 18 or so, but this is complicate to manage).Then you can for example have 3 different new arrays of images for each state of movement.For example when the bee moves left say stateBee =0 for right stateBee = 1 for sit stateBee = 2 or whatever. You need the stateBee to represent these different types of movements. Of course often this is more complicate when there are different sets of images (in the initial sheet) when the bee moves left, moves right or sits (stings, sleeps…). Int counter=0 // a counter for the animation (the frames)įor(int x=0 x =mySpriteSheetArray.length()) You copy (using get()) the single images from the sheet into an image array.īefore setup() PImage mySpriteSheetArray = new PImage // init array Let’s say there are 6x2 images in the spritesheet (correct these numbers in my codes). When the sheet is some kind of grid you want to parse this. In my understanding it contains a group of images of the bee (different frames). ******* drawing section ! *********** //Ĭan you post the initial bee spritesheet (charImage) here please? NoFill() // to adjust the image in the screen properly in fullscreenīackground = loadImage("YellowFlowers.jpg") ĬharImage = loadImage("bee_spritesheet.png") ĬharImage = createImage(spriteWidth,spriteHeight, RGB) My code: /****** Setup section starts here ****** // Could someone tell what I should do towards my code in order to load the spritesheet? What I see when I run my code is a black box that I can move with my keyboard. I have been coding a simple 2D game in Processing 3.5.4 for university purposes, however I’m stuck in the part in which I should make the PNG spritesheet load in screen with all its colours and moves.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |