![]() |
ShowImg layers
How would I draw the image in the showImage function under the player?
PHP Code:
|
probably a better way to do this than my suggestion, but:
findimg(index).layer = 0; will draw that on a layer below the player's. |
You're on the right track.
NPC Code:showimg(200, "block.png", 30, 30); That would work in the "traditional" way (ie, in GS1 that is how you'd need to do it, minus the quotes and parentheses). NPC Code:temp.img = showimg(200, "block.png", 30, 30); .. would be a nice way to do it in GS2. However, NPC Code:showimg(200, "block.png", 30, 30).layer = 0; would also work. The reason yours didnt work is because you tried -1. -1 and floats don't work. In addition, visibility above 4 will draw to the player's screen's XY, so be wary of that. Finally, be careful when dealing with showimg indices lower than 200, as they by default will show serverside unless disabled in server options. As a method of protocol, tend to start with image indices greater or equal to 200. One final tip, if I may, is that if you want fractional-layer showimg, use showimg2. For example, if you want 2 images to draw under player, but img1 to draw under img2, give img1 a 'z' value of 1 (and increase its y by 1 to compensate, so it doesn't move). Due to its higher z, it'll draw over the other image on the 0-layer, but it'll still draw under players on the 1-layer. |
Quote:
IS IT POSSIBLE to have certain tiles draw over that layer? For example if I have "block.png" with the layer set to 0 in a ShowImg, how do I get the very top left tile in a tile set to draw over the block, but under the player? |
Quote:
can you take some screenshots of what you have or are working on? there is a tile layer feature, but it sounds like you're trying to do something that can be done in a completely different manner...and much easier... |
1 Attachment(s)
Okay, the red in this picture is the showImg.
The grass is the top left two tiles. The tiles are showing over the image. |
Quote:
A little more insight as far as what you want to do would be extremely helpful -- trust me. Many of us here are capable of scripting our own versions of whatever you are trying to do, so don't worry about someone stealing your idea -- it's very likely it's already been done before anyway, and if it hasn't, then posting it for the community to see is beneficial to those trying to learn. |
1 Attachment(s)
Quote:
Sorta like the picture I put of the sonic screen shot. The ground would be the tiles, and the backing would be a showImg. (I have a set screen size) |
Quote:
I can't think of an easy or effective way to do that with showimg, as even with tile layers, tiles do not seem to display above an image displayed with showimg even on layer 0. Alternatively, the background could be tiled as well (probably easiest method, but it would eliminate the possibility of having animated backgrounds unless you got creative and displayed some images in the locations that needed to be animated...). You could make a custom Type 1 tileset as there are many non-blocking spaces and possibilities that could be used for background purposes. Maybe someone with a bit more experience or insight could chime in. On a slightly related note: Dusty did release a platformer some years ago, and I just found out about it myself recently. http://forums.graalonline.com/forums...hp?t=134257875 He does not have backgrounds in it, but it could be possible to make up some background tiles, and just use those as a background... |
Quote:
Well I appreciate the input. And I actually Have the whole platform engine done and it runs great. I may put a video of it in, and perhaps post the script because I don't know if I'm going to peruse through with the server, rather than use it as a playground to home my scripting skills. Still new to GS2 but learning everyday! |
Quote:
you can PM me the server name and I could come check it out? |
Quote:
BUT while we're on the subject on platformers... What if instead of tiles, I used ground NPCS, like 128x32 big. Would that be too many NPCs per level?? Would I have lag or any other problems? |
you could probably just make a big 64tiles x 64tiles image to lay down on a level and use setshape2 to define how parts of the image work.
this could be both a good and bad thing, depending on how many levels you plan on having and is probably a hackish method to achieve what you want.. TServerNPC.setshape2(int, int, obj) - enables tile-based blocking behaviour. Parameters are tile width, height and an array of tile types; you have to set it on both server-side and client-side to make it blocking on both server and client Here is some information about setshape2 and tiletypes http://wiki.graal.net/index.php/Tiletype |
Can you set the layer of the player?
like... Quote:
I have an image with the layer of 1 but I need it to draw under the player. NOTE: I don't wanna use drawunderplayer() |
See:
Quote:
|
Here's a sample of what I've been messin with.. |
Shows the backing sorta move as the player jumps.
|
potential there.
what is with the odd red thing at the bottom? |
Quote:
|
imm the king of layers
|
A Couple Last Questions
So I have a few final questions about the showImg functions if you guys don't mind...
1. How do I rotate an image in the showImg? 2. What is the greatest size (in pixels) that I can have in a showImg with the index being below 200? (So other players can see) I know if the image is too large, it won't show |
Quote:
|
Quote:
Quote:
|
Quote:
How would I do a horizontal flip of an image on the y axis? PHP Code:
|
| All times are GMT +2. The time now is 06:58 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.