Gamestudio Links
Zorro Links
Newest Posts
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
3 registered members (Aku_Aku, 7th_zorro, Ayumi), 1,050 guests, and 1 spider.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Changing a bmap for a sprite? #134597
06/07/07 20:16
06/07/07 20:16
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline OP
Member
Scramasax  Offline OP
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
I'm trying to change the bmap on a sprite. Here's what I've done. What am I doing wrong? Thanx.

Code:
  
bmap testBMAP =<rooidle_west0000.pcx>;


function changeMap()
{
my.bmap =testBMAP;
}




www.moxiefish.com George Lancaster
Re: Changing a bmap for a sprite? [Re: Scramasax] #134598
06/07/07 20:20
06/07/07 20:20
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
the bmap for th sprite is also a skin, so you have to use bmap_for_entity to get the bmap pointer to the texture and then you can replace it

Re: Changing a bmap for a sprite? [Re: Scorpion] #134599
06/07/07 21:43
06/07/07 21:43
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline OP
Member
Scramasax  Offline OP
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
I tried using bmap_for_entity, but no luck. Am I doing this right? Or is there a pointer conversion I'm screwing up on?
Code:
  
bmap testBMAP =<rooidle_west0000.pcx>;
bmap* ptr;

function changeBMap()
{
ptr =bmap_for_entity(my,0);
bmap_unlock(ptr);
ptr =testBMAP;
}




www.moxiefish.com George Lancaster
Re: Changing a bmap for a sprite? [Re: Scramasax] #134600
06/08/07 05:02
06/08/07 05:02
Joined: Mar 2006
Posts: 2,503
SC, United States
xXxGuitar511 Offline
Expert
xXxGuitar511  Offline
Expert

Joined: Mar 2006
Posts: 2,503
SC, United States
You don't need the bmap_unlock()

Even then, I don't kow if copying the image will work that way.

Here's another idea using bmap_blit() to copy the image:
Code:

bmap testBMAP = <rooidle_west0000.pcx>;
bmap* ptr;
function changeBMap()
{
ptr = bmap_for_entity(my,0);
bmap_blit(ptr, testBMAP, 0, 0);
}




xXxGuitar511
- Programmer
Re: Changing a bmap for a sprite? [Re: xXxGuitar511] #134601
06/08/07 05:59
06/08/07 05:59
Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Xarthor Offline
Expert
Xarthor  Offline
Expert

Joined: Jul 2002
Posts: 4,436
Germany, Luebeck
Well what about the good old "ent_morph(entity, string);" ?

If you have a pointer to your sprite just do something like this:
Code:

function changeSprite(_ent,_file)
{
ent_morph(_ent, _file);
}

//call like this:
changeSprite(mySprite_Pointer,"new_bitmap.pcx");


Not tested but should work.

EDIT:
Now that I've read Scorpion's response I guess that you could give "ent_morphskin(ENTITY* entity, STRING* filename);" a shot too.

Last edited by Xarthor; 06/08/07 06:02.
Re: Changing a bmap for a sprite? [Re: Xarthor] #134602
06/08/07 10:57
06/08/07 10:57
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
yep everyhting should work, if you can change the skin of an entity, you can also change it by a sprite :]

Re: Changing a bmap for a sprite? [Re: Scorpion] #134603
06/08/07 16:37
06/08/07 16:37
Joined: Aug 2005
Posts: 155
USA San Diego CA
Scramasax Offline OP
Member
Scramasax  Offline OP
Member

Joined: Aug 2005
Posts: 155
USA San Diego CA
bmap_blit is what I need, but I don't see it in the manual and it doesn't like it in the script editor. Is it in the beta?

The real code looks like this. I'm using a link list in a .dll to push out various BMAPs so I need it to be a bmap and not the name of one.

Code:

function animNorth_entSprite()
{
var animRate =60;
var numFrames =0;
numFrames =GetNumAnimBMap(my.northKeyIdle);
var animFrame =0;
while(1)
{
animFrame +=GetSeconds();
if(animFrame>=numFrames)
{
animFrame =0;
}
my.bmap =GetAnimBMap(my.northKeyIdle,int(animFrame));

my.scale_x =1;
my.scale_y =1;

wait(1);
}
}



Guess I'll write a c++ function for now.

Last edited by Scramasax; 06/08/07 16:46.

www.moxiefish.com George Lancaster

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1