Jump to content
  • 1
svenvandevelde

Hide sprites in vera

Question

Posted (edited)

I am preparing this shoot-em up. But i see that sprites x and y position indexes with 0, are stuck in the visible area of the map (totally at the top left)...

What are your techniques to "hide" sprites in the vera card? Because there seems to be only one switch to turn all sprites on or off.

 

In the below picture you see the fired bullets hanging at index y=0 on the top ...

So what is the best technique to hide those?

 

image.png.46a98fccb5136092a296bbe2a5fdfe67.png

 

If you could maybe share your thoughts or experience ... that would also help others maybe ...

Edited by svenvandevelde

Share this post


Link to post
Share on other sites

9 answers to this question

Recommended Posts

  • 0
Posted (edited)
19 minutes ago, Johan Kårlin said:

Easily done to miss things : ). Of course the other way is to just place the sprite outside screen boundaries, for example by setting the vertical position to 512. If you constantly calculate sprite positions it might feel more natural to only work with the position registers and never change the Z-depth, at least that is what I have found.

OK. Thank you.

record.gif.f1a70fc1a4ef6cf792b3ed1c93ae7d36.gif

I got it working now ...

 

Edited by svenvandevelde
  • Like 4

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
1 minute ago, Johan Kårlin said:

You can actually disable sprites individually by setting the Z- depth to 0.

ah!!!!. I oversaw that! Wonderful! That makes it now easy for me.

Thank you very much Johan. I do have a learning curve ...

Edited by svenvandevelde

Share this post


Link to post
Share on other sites
  • 0

Easily done to miss things : ). Of course the other way is to just place the sprite outside screen boundaries, for example by setting the vertical position to 512. If you constantly calculate sprite positions it might feel more natural to only work with the position registers and never change the Z-depth, at least that is what I have found.

Share this post


Link to post
Share on other sites
  • 0
Posted (edited)
40 minutes ago, Johan Kårlin said:

Easily done to miss things : ). Of course the other way is to just place the sprite outside screen boundaries, for example by setting the vertical position to 512. If you constantly calculate sprite positions it might feel more natural to only work with the position registers and never change the Z-depth, at least that is what I have found.

The engine I"m building has for each "sprite" a collection of sprites that can be animated, and a structure that defines the sprite height, width, bpp, hflip, vflip and zdepth ...

image.png.9f8179b6928d5d89f7132172b72023d2.png

Doing so, allows me to keep all the properties of the sprite settings for a collection of sprites, and it allows sprite animation. The little plane as you can see "rotates" when the mouse goes to the left or to the right.
The sprites are stored in banked RAM, and I plan to copy them "on demand" to the vera. I've built a vera "heap" manager, that allows malloc, realloc and free in VRAM, so that sprite allocations can be done dynamically as
the game progresses, and I don't need to bother with memory mapping the areas where teh sprite data will be placed in the VRAM when copying from banked RAM ... Hence you can see the "memory dump" on the screen.

Got this new term ... VRAM and BRAM ...

 

Side note ... I also have the tile engine ready, which scrolls the background (see Space Game shoot'em up progress ... - X16 Software Library Chat - Commander X16™ Community).

Once i have my flight engine working, I'll integrate both engines into one set ...

The next thing will be the "enemies"... and then the fun part, sprite collisions and explosions ...

Edited by svenvandevelde
  • Like 1

Share this post


Link to post
Share on other sites
  • 0

Lovely ...

Got collision detection working now with VERA hardware detection ... VERA implements collision detection very nice.

Thanks to those who have been explaining how collision works on various sites and also here commenting.

Especially @AndyMt, @Geehaf and the explanation of flyinglow at this site helped a million times!
Sprites in Assembly III - Collision detection (8bitcoding.com).
And thanks @Johan Kårlin for showing me the way to hide those sprites...

The CX16 default VERA documentation lacks essential details in terms of collision detection.

Now I have all the ingredients to continue with my game ... It's exciting.

record.gif.559896f33af12605d19a9f96f91fa59f.gif

I'll need to do some explosions etc.

  • Like 3

Share this post


Link to post
Share on other sites
  • 0
13 hours ago, Johan Kårlin said:

Nice job! I am looking forward to see what will become of this!

😉 it's going to be a hard work ...

There is another question related to Sprite hiding....

How to position sprites beyond the top and left border of the screen?

The value zero seems to show the whole Sprite at the top or left border of the screen. On the c64, sprites were hidden at this position.

So in vera, how to move sprites up or left beyond these borders?

 

Share this post


Link to post
Share on other sites
  • 0
1 hour ago, svenvandevelde said:

So in vera, how to move sprites up or left beyond these borders?

You can just treat the 10-bit position values as 2's complement, and it just works. So, $3FF is effectively -1, $3FE is -2, and so on.

  • Like 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Please review our Terms of Use