Sprites in MSX-C

Página 6/8
1 | 2 | 3 | 4 | 5 | | 7 | 8

Por Wolverine_nl

Paragon (1159)

Imagen del Wolverine_nl

15-05-2014, 11:22

I will do this later Julio Smile

Also the problem with the bullet in place doesnt seem to be the problem, it is the sprite repeating itself from the start position,

An array which can act as a counter seems to me to be the logical solution, it also will maintain a maximum amount of "bullet" sprites on screen, so a speed ratio is in order to make it a non disturbing feature. (when I have time again this week/weekend -=lol=- )

Por Daemos

Paragon (2008)

Imagen del Daemos

15-05-2014, 12:41

Or make it so that only a new bullet is released after the fire button was released and retriggered.

unless you want it to autofire offcourse, then you have to count frames in between the shots.

you could for example make a framecounter that increased each frame. Then just allow bullet fire only at the 3th,5th ,7th etc frame.

You could also try to make the bullet a object like your enemies. They will then share the same properties, very usefull if you require more advanced interactions.

Por Wolverine_nl

Paragon (1159)

Imagen del Wolverine_nl

15-05-2014, 13:31

@Daemos
That last option sound very interesting, if i understand you correctly, it gives me more options for let's say, special bullets fire etc. thanks for the idea, saves me times, the coding is now that the enemy is 1 function and so is the bullet(s).
But autofire ... I don't want that, I was actually thinking of 1 shot per hit, the array is necessary non the less, I dont want an overflow of bulletsprites and also to make it more challenging.

Por Daemos

Paragon (2008)

Imagen del Daemos

15-05-2014, 13:35

here is what you can do. You enemies and bullets share the same function. So your bullets are objects like your enemies. Each bullet you fire increases a counter and each bullet that is destroyed decreases the counter. Now since each bullet is a object you can treat it that way. You can use your same object collision detection for the bullets as well not to mention that you can let the bullets do special things or even add AI to them. Like this you will never have a sprite overflow since your max amount of objects in game is defined. You can never have too many bullets nor enemies this way. You also don't need to creat special handlers or bullet detectors. Just object to object detection routines. Like this you can also let your enemies interact with each other but also with each others bullets etc etc.

For the bullet firing: you could read the newly pressed key and currently pressed key. So you basicly start reading your keyboard at the start or end of the frame (or in the middle) and update the status that the key is pressed but your only keep the newly pressed status active for 1 frame. So if you keep the key pressed the newly pressed byte for example is 0 and the pressed byte is still 1. You only fire one bullet if the newly pressed byte is 1 thus forcing the user to first release the button and press it again.

Por Wolverine_nl

Paragon (1159)

Imagen del Wolverine_nl

15-05-2014, 13:44

I will re read your post Daemos when I am busy later tomorrow coding, makes allot of sense, thanks!

Por Daemos

Paragon (2008)

Imagen del Daemos

15-05-2014, 13:53

np Smile if your need some sample code (only ASM...) just ask and Ill rip some out of my project. I can also make some diagrams of the mentioned functions to make it clear.

Por Wolverine_nl

Paragon (1159)

Imagen del Wolverine_nl

15-05-2014, 14:00

A diagram would be nice Daemos, I am coding in MSX-C with this, and my ASM skills are basic at best Wink

Por Daemos

Paragon (2008)

Imagen del Daemos

15-05-2014, 14:32

I will build a diagram for you when I get to it.

Por Wolverine_nl

Paragon (1159)

Imagen del Wolverine_nl

15-05-2014, 14:37

Ok, thnx, no hurry, life is busy enough Wink

Por jlemos

Resident (58)

Imagen del jlemos

17-05-2014, 06:09

Cool!

I'm waiting for this.

Big smile

Página 6/8
1 | 2 | 3 | 4 | 5 | | 7 | 8