dMZX Forums: The Sprite Tutorials - dMZX Forums

Jump to content

Page 1 of 1

The Sprite Tutorials Tutorials 21-24

#1 User is offline   Graham 

  • . "@Master Procrastinator"
  • PipPipPipPip
  • Group: Members
  • Posts: 625
  • Joined: 28-December 12
  • Gender:Male
  • Location:Oregon

Posted 10 March 2015 - 08:08 AM

I've finally gotten around to finishing up these sprite tutorials. Sorry it took so long, those of you who were waiting, I just wanted to make sure I did a thorough job of explaining everything correctly. The 4 parts together total 1:45:35 worth of video explanation which is actually not bad, considering I detailed every aspect of sprites I could think of and I tend to be long winded.

Sprites Pt. 1 (Initialization)
Sprites Pt. 2 (Scrolling)
Sprites Pt. 3 (Collision)
Sprites Pt. 4 (Tips & Tricks)

Part 4-Tips & Tricks was sort of inspired by Lancer's recommendation to do a post-mortem on your game once it's finished. It contains a lot of info about how I built my game. This way it's still fresh in my head and I haven't forgotten anything yet. None of it is spoilery, it all takes place on the test board and just talks about the generation of sprites.

This post has been edited by Graham: 10 March 2015 - 08:36 AM

Currently working on Servo for MegaZeux, I hope to complete it by the middle of 2015? Who knows...

"Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you’re a mile away and you have their shoes."
-Jack Handey
0

#2 User is offline   Old-Sckool 

  • megazeux breaker
  • PipPipPipPip
  • Group: Members
  • Posts: 649
  • Joined: 07-June 05
  • Gender:Male

Posted 11 March 2015 - 11:27 PM

you don't have to disable the collision of a sprite to make it interactive in certain situations.

Quote

SPR_CLISTn (read-only)

A list of flagged collisions after a collision test was
performed. Values of n from 0 to (SPR_COLLISIONS - 1) are
valid. If the background collided, SPR_CLIST0 is always set to
-1 to indicate this.

SPR_COLLISIONS (read-only)

The number of sprites/background listed in SPR_CLISTn.


When you branch on a collision check, a list of all sprites that were collided into is generated with spr_collisions being the number of collisions, and spr_clist elements containing the sprite collided into. You can then loop over the list and pick and choose what sprites you want to interact with.

Your solution is nice though because it eliminates the need to track what sprite is what thing, and elements like coins can just collide into the player instead of the other way around.

This post has been edited by Old-Sckool: 11 March 2015 - 11:28 PM

<Nadir> mzxers don't make GAMES, usually
<phthalocyanine> they make experiences.
<Nadir> demos, more like
<Nadir> a glimpse into what could have been if mzx wasn't such a bore to work with
<Nadir> actually, i'm being unfair
<Nadir> i would have made mzx games if it was capable of running on more than 20 computers worldwide in 1998
<Nadir> >:D

<%Alice> functor
<%nooodl> i hear C++ has a thing called functors and they're completely different from Haskell functors...
<rorirover> the result is the most horrid thing in C++, it's basically black magic and it transforms any code you're writing into some eldritch monstrosity
0

#3 User is offline   Graham 

  • . "@Master Procrastinator"
  • PipPipPipPip
  • Group: Members
  • Posts: 625
  • Joined: 28-December 12
  • Gender:Male
  • Location:Oregon

Posted 12 March 2015 - 12:11 AM

View PostOld-Sckool, on 11 March 2015 - 03:27 PM, said:

you don't have to disable the collision of a sprite to make it interactive in certain situations.



When you branch on a collision check, a list of all sprites that were collided into is generated with spr_collisions being the number of collisions, and spr_clist elements containing the sprite collided into. You can then loop over the list and pick and choose what sprites you want to interact with.

Your solution is nice though because it eliminates the need to track what sprite is what thing, and elements like coins can just collide into the player instead of the other way around.


Yeah true, and I covered that in part 3 on collision. With my example I gave, with the fire program, I only had to modify that program to change how it interacted with every other sprite on the board, versus modifying every other program to affect how they interact with fire. I guess both methods have their uses.

Another great use of this method would be enemies. They could be checking for collision when they have a defined collision box. They could then stop at custom blocks, hurt the player, and pass through any other sprites on board once collision is turned off, except doors.

This post has been edited by Graham: 12 March 2015 - 12:12 AM

Currently working on Servo for MegaZeux, I hope to complete it by the middle of 2015? Who knows...

"Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you’re a mile away and you have their shoes."
-Jack Handey
0

#4 User is offline   T-Bone 

  • Wastelander
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,487
  • Joined: 16-August 02
  • Gender:Male
  • Location:Canada

Posted 17 August 2015 - 02:02 AM

Its been really helpful looking at the sprite detection stuff. Kind of makes me wish i did a few of my projects in the correct way from the beginning. For instance the manner of which I used to use sprite detection was simply if c?? sprite p01 at 0 0 rather than doing a sprite collision test. Hopefully anyone interested in diving into sprites fresh, will check out these tutorials before trying to figure them out on their own.
Youtube - teabone3 - Twitter - teabone3 - Twitch - teabone3
0

#5 User is offline   Graham 

  • . "@Master Procrastinator"
  • PipPipPipPip
  • Group: Members
  • Posts: 625
  • Joined: 28-December 12
  • Gender:Male
  • Location:Oregon

Posted 19 August 2015 - 01:20 AM

Thanks, that's encouraging to hear. :-)
Currently working on Servo for MegaZeux, I hope to complete it by the middle of 2015? Who knows...

"Before you criticize someone, you should walk a mile in their shoes. That way, when you criticize them, you’re a mile away and you have their shoes."
-Jack Handey
0

Share this topic:


Page 1 of 1


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users