sprite problem

BlitzPlus Forums/BlitzPlus Beginners Area/sprite problem

Ice T.(Posted 2006) [#1]
Im a noob and I was wondering, say you have a guy
then when you press spacebar he swings a sword then goes back to looking the same way,how would you do that?


CS_TBL(Posted 2006) [#2]
Well, for a start, there isn't a command called 'SwingSword(player)'.. so everything like that has to be programmed yourself. And there are quite some ways ppl use to implement this.

First, draw all the possible animation phases of your character into a big image, all walking angles, and all the things the character does. (jumping, clibing, swordfighting, shooting, dying etc.) You load this with LoadAnimImage (see the help) and make sure each frame has one specific animation frame.

Then you create a timer for your character, and each timertick (I recommend using the eventsystem for this) changes the current animationframe, based on tables.

The only thing you need to do is creating these tables (a table for walking, a table for swordfighting etc.) after you press some key.. like, if space = swordfighting, then you must make sure the character-animator points to this swordfight table.

You could also create one big table with all the animations inside and work with ranges.

In any case, if you're a noob then rather learn decent programming first. It might be cool to start out with a game, but that's quite high-profile already if you're just starting out. The fact that Blitz is marketed as a gamelanguage is a bit misleadige perhaps. Sure, there are handy commands to do your gfx routines, but what it doesn't do is create the gamelogic for you.


Ice T.(Posted 2006) [#3]
thanks CS_TBL, i was using separate images to do every thing


Ice T.(Posted 2006) [#4]
by the way,how would u use collisions with one big image?

thanks to who answers this


Andres(Posted 2006) [#5]
You can either create another collection of images that have the collisions on it. Black and white where white intercepts with objects.


Ice T.(Posted 2006) [#6]
what does CL_TBL mean by "tables" and how does that
work out with the code:

if player_frame>4
player_frame = 0
elseif player_frame < 0
player_frame = 4
endif

when the jumpframe is 5?


Andres(Posted 2006) [#7]
It's used for not leaving freim dimensions.
player_frame = player_frame mod 6


CS_TBL(Posted 2006) [#8]
Everyone has his own solution, I'd use tables, others might use other solutions.

For an ideal modulo, check the code archives for my Box functions.


Ice T.(Posted 2006) [#9]
could I have some examples of tables,
player_frame = player_frame mod 6
and a definition of eventsystem please?


CS_TBL(Posted 2006) [#10]
Did you ever read the manual? The whole event thing is explained in detail there. (and the B+ manual is quite good! You better NOT buy BlitzMax/GUI yet..:P)

Again I'll repeat what I said before: if you're a beginner, then that's ok, but begin at the beginning then. Creating a game is somewhat like the end of the learning traject already.

There are pleny o' ppl here who are ready to assist you -with pleasure- on the learning path right from the beginning, but how motivating is it for those ppl to explain things you aren't up to yet (like talking to a wall!)?

Blitz is not a gamebuilder, it's a programminglanguage with a number of handy gfx-routines, commonly used in games.. that's it. Programmingwise it's still a normal procedural programminglanguage.
If you want to create games with some drag/drop/click/try tool, then you don't need to know very much in advance.. but if you want to create games in Blitz, then you simply need to learn programming.. this is the choice you have to make.

What is a game? Visually a game is moving gfx and a certain type o' human interaction. That's it. For the rest a game is just ordinary boring routines, database-related, some math etc. You can't make games without knowing how to program generic stuff!

So, to summarize: everyone here is ready to help you out, but: start at the beginning and accept that a game is actually the end of your learning traject! (and yes, I know it sucks, there's this hype/romanticism around creating games, so ofcourse you want to start with a game rather than boring routines..)


Ice T.(Posted 2006) [#11]
OK thanks so much everyone I got a Much better idea
of the imaging and of the logic of blitz+ , thanks again
and see ya around the site