Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (AndrewAMD, VoroneTZ), 1,258 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
[help] cutting the same image in many entities #268160
05/27/09 18:11
05/27/09 18:11
Joined: Apr 2002
Posts: 117
Spain
Abstracto Offline OP
Member
Abstracto  Offline OP
Member

Joined: Apr 2002
Posts: 117
Spain
Hi,
im trying to make a simple puzzle game.
The puzzle is a big image, and im using it as a texture.
I made a box tile model (puzzle piece), so it can show a small part of the big image (it has been placed as the skin of the box).
My idea was to create many tiles, and then displace the texture or the UV coordinates for every tile model, so each model shows a part of the complete image.
(Then the player can touch and move the tiles, well, you know)

Im not sure how to change the UV mapping of each tile model (it seems im changing the UV coordinates of ALL models at the same time),
how can i do this? is there a better way (i.e: cutting the bitmap image on many squares, and then assign each to one model, or others ideas)?

Thanks!

Re: [help] cutting the same image in many entities [Re: Abstracto] #268177
05/27/09 20:04
05/27/09 20:04
Joined: Apr 2009
Posts: 298
Southern Oceans
KiwiBoy Offline
Member
KiwiBoy  Offline
Member

Joined: Apr 2009
Posts: 298
Southern Oceans
Search 'materials' in manual, A7 shifts UVs by materials now.


Use the 'manual' Luke, the manual is your friend. 'Self reminder' smile

My WebPage
Re: [help] cutting the same image in many entities [Re: KiwiBoy] #268219
05/28/09 07:34
05/28/09 07:34
Joined: Apr 2002
Posts: 117
Spain
Abstracto Offline OP
Member
Abstracto  Offline OP
Member

Joined: Apr 2002
Posts: 117
Spain
im using lite-c, free version for this game,
i own a A6 version too, i don't own A7,

well, i will take a look at materials, thanks!

i have found that i can "copy" entities using clone, i think this way i can modify each model UV coordinates individually... as every model has only 12 triangles, i think its not a big memory waste.

Edit: using ent_clone on lite-c free version, crashes. On the lite-c help file, there is no ent_clone function....
Another way can be to load a big bitmap, and then copy smaller rectangles of this bitmap, for the models skin, so each model has a small skin, and all different, what do you think its better?

Thanks!



Last edited by Abstracto; 05/28/09 14:09.
Re: [help] cutting the same image in many entities [Re: Abstracto] #268504
05/29/09 17:55
05/29/09 17:55
Joined: Apr 2002
Posts: 117
Spain
Abstracto Offline OP
Member
Abstracto  Offline OP
Member

Joined: Apr 2002
Posts: 117
Spain
well,
i have found that i can write something like this
BMAP* name = "filename#(x)#(y)#(width)#(height)";
to get part of a image file, but i need to make the cut on runtime, i cannot define all tiles this way, because i want to load de image on runtime (the player selects an image, and the the program loads it)

i found this function also: bmap_blitpart, but it is missin on the help files, so im not sure i can use it,
anyway, ent_clone keeps crashing, i dont know why

Re: [help] cutting the same image in many entities [Re: Abstracto] #268563
05/29/09 23:46
05/29/09 23:46
Joined: Feb 2008
Posts: 3,232
Australia
EvilSOB Offline
Expert
EvilSOB  Offline
Expert

Joined: Feb 2008
Posts: 3,232
Australia
Try this. Im using A7.77 commercial, but if blitpart works for you, this function will do the job
Code:
BMAP*	bmap_create_blitpart(BMAP* SourceBMAP, var x_map, var y_map, var x_size, var y_size)
{	if(SourceBMAP==NULL)		return((BMAP*)NULL);
	VECTOR tmpV0, tmpV1;
	BMAP*	TargetBMAP = bmap_createblack(x_size,y_size,24);
	//bmap_fill(TargetBMAP, vector(128,128,128), 100);
	vec_set(tmpV0, vector(x_map*x_size,y_map*y_size,0));
	vec_set(tmpV1, vector(x_size,y_size,0));
	bmap_blitpart(TargetBMAP, SourceBMAP, NULL, NULL, tmpV0, tmpV1);   
	return(TargetBMAP);
}

Example:
BMAP* ThisSkin = bmap_create_blitpart(SourceBMAP, startpos_x, startpos_y, target_width, target_height);

NOTE : this only creates bmaps with "power of two" sizes. The data it retrieves is correct though.



"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial
Re: [help] cutting the same image in many entities [Re: EvilSOB] #268679
05/30/09 16:33
05/30/09 16:33
Joined: Apr 2002
Posts: 117
Spain
Abstracto Offline OP
Member
Abstracto  Offline OP
Member

Joined: Apr 2002
Posts: 117
Spain
ok, thanks guys!,

with the bmap_create_blitpart and some changes, i at last got it working,
i have now a 1024x1024 image, and 16x16 entities, with a 64x64 texture each,
so putting all tiles on the right position, side by side , i can see the whole image.
I have noticed a small image distortion on the borders of each tile, but its not very noticeable.
im now tryin to continue the game, i will post an image of the game as i get it to evolve to a real game.


Last edited by Abstracto; 05/30/09 16:34.
Re: [help] cutting the same image in many entities [Re: Abstracto] #321529
04/29/10 23:45
04/29/10 23:45
Joined: Jul 2004
Posts: 1,710
MMike Offline
Serious User
MMike  Offline
Serious User

Joined: Jul 2004
Posts: 1,710
true.. i got that distorcing effect, too , is it like blur? soft edge

Re: [help] cutting the same image in many entities [Re: MMike] #325522
05/27/10 00:46
05/27/10 00:46
Joined: May 2010
Posts: 13
I
IvanOFF Offline
Newbie
IvanOFF  Offline
Newbie
I

Joined: May 2010
Posts: 13
Help
//bmap_fill(TargetBMAP, vector(128,128,128), 100);
vec_set(tmpV0, vector(x_map*x_size,y_map*y_size,0));
vec_set(tmpV1, vector(x_size,y_size,0));
uninamble files! plz Help!


Moderated by  HeelX, Spirit 

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