9Panzer
Well-known member
So I've been wanting to do add some simple effects to my next build and wanted to dive deeper into sprites. one of the challenges we have is that the NESmaker object system is quite Resource intensive so doing fun little animations using objects tends to not work well beyond 4 or 5 objects.
This code is very simple and doesn't use the object system at all. Instead it just tells the game to draw the sprite on the screen with no collision checks, size checks, etc... so you can use it without gimping your game.
1. First make a pair of Variables. I used "Object Variables" instead of "User Variables" for this as the User Variables didn't refresh quick enough for the rain to be nice and smooth. The Variables I used in this example are "RainingV" and "RainingH".
2. Open your "doSpritePreDraw" (Or Postdraw depending on if you want them rain infront or behind). and put this code in:
For this example I have used the 111 sprite on your objects.
3. add this to your timer script (add more if you want faster rain)
That's it! Enjoy your raining game!
This code is very simple and doesn't use the object system at all. Instead it just tells the game to draw the sprite on the screen with no collision checks, size checks, etc... so you can use it without gimping your game.
1. First make a pair of Variables. I used "Object Variables" instead of "User Variables" for this as the User Variables didn't refresh quick enough for the rain to be nice and smooth. The Variables I used in this example are "RainingV" and "RainingH".
2. Open your "doSpritePreDraw" (Or Postdraw depending on if you want them rain infront or behind). and put this code in:
LDA RainingH
SBC camX ;When Scrolling - to make the rain move correctly
STA temp1
LDA RainingV
STA temp2
DrawSprite temp1, temp2, #111, #%00000001
LDA RainingH
ADC #40
SBC camX ;When Scrolling - to make the rain move correctly
STA temp1
LDA RainingV
ADC #100
STA temp2
DrawSprite temp1, temp2, #111, #%00000001
LDA RainingH
ADC #90
SBC camX ;When Scrolling - to make the rain move correctly
STA temp1
LDA RainingV
ADC #90
STA temp2
DrawSprite temp1, temp2, #111, #%00000001
LDA RainingH
ADC #130
SBC camX ;When Scrolling - to make the rain move correctly
STA temp1
LDA RainingV
ADC #180
STA temp2
DrawSprite temp1, temp2, #111, #%00000001
LDA RainingH
ADC #200
SBC camX ;When Scrolling - to make the rain move correctly
STA temp1
LDA RainingV
ADC #200
STA temp2
DrawSprite temp1, temp2, #111, #%00000001
For this example I have used the 111 sprite on your objects.
3. add this to your timer script (add more if you want faster rain)
DEC RainingH
DEC RainingH
DEC RainingH
Inc RainingV
Inc RainingV
Inc RainingV
That's it! Enjoy your raining game!