Sprite placement tweak

6 replies [Last post]
nemo
nemo's picture
User offline. Last seen 1 year 8 weeks ago. Offline
Joined: 2009-01-28
Posts: 1861

This is kinda for mikade, since I so rarely see him these days...

-- test of modification of PlaceSprite.  0.9.22-dev
function onGameTick20()
        if GameTime%1000 == 0 then
                PlaceSprite(GetRandom(LAND_WIDTH),GetRandom(LAND_HEIGHT), sprThoughtCorner, 0, 
                    (math.random(30,250))               --      A
                    + (math.random(30,250)*0x100)       --      B
                    + (math.random(30,250)*0x10000)     --      G
                    + (math.random(30,250)*0x1000000),  -- RGBA R
                    GetRandom(2)==1, -- don't overwrite existing land.
                    GetRandom(2)==1, -- flip sprite horizontally
                    GetRandom(2)==1, -- flip sprite vertically
                    lfBouncy)
                EraseSprite(GetRandom(LAND_WIDTH),GetRandom(LAND_HEIGHT), sprThoughtCorner, 0, 
                    GetRandom(2)==1, -- erase land only where the pixels match the land flag provided
                    GetRandom(2)==1, -- only erase the provided land flags. don't touch other land flags or LandPixels
                    GetRandom(2)==1, -- flip sprite horizontally
                    GetRandom(2)==1, -- flip sprite vertically
                    lfBouncy)
        end
end

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

nemo
nemo's picture
User offline. Last seen 1 year 8 weeks ago. Offline
Joined: 2009-01-28
Posts: 1861

Vaguely related, although I'd mentioned it to him before.
http://m8y.org/hw/NeonRope.lua
http://m8y.org/hw/neonrope1.png
http://m8y.org/hw/neonrope2.png

Racer now has:
elseif GetGearType(gear) == gtRope and TeamRope then
SetTag(gear,1)
SetGearValues(gear,nil,nil,nil,nil,nil,nil,nil,nil,nil,nil,GetClanColor(GetHogClan(CurrentHedgehog)))
in onGearAdd

teamrope=1 in scheme

(vaguely related in that it is lua and the random colour set is the same ☺ )

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

TheMadCharles
TheMadCharles's picture
User offline. Last seen 17 hours 20 min ago. Offline
Joined: 2012-10-19
Posts: 127

This looks interesting...

oh hi

if any staff is reading this, plz rename me to "h3oCharles", thx in advance

nemo
nemo's picture
User offline. Last seen 1 year 8 weeks ago. Offline
Joined: 2009-01-28
Posts: 1861

Thinking I'll tweak erase to add as an option only removing land flags passed in, not all Land/LandPixels.
Could use that to toggle bounciness or indestructibleness of something more easily, or placing a sprite, then removing all collision from it, for graphical purposes only.

*done*

--
Oh, what the heck. 1PLXzL1CBUD1kdEWqMrwNUfGrGiirV1WpH <= tip a hedgewars dev

mikade
mikade's picture
User offline. Last seen 9 weeks 5 days ago. Offline
Joined: 2010-10-22
Posts: 355

Looks good. Now what we need next is option to show custom/variable sprite at cursor. That way we can finally have a more accurate editor and Construction Mode can look less hack-y, too.

mikade
Hedgewars Developer

TheMadCharles
TheMadCharles's picture
User offline. Last seen 17 hours 20 min ago. Offline
Joined: 2012-10-19
Posts: 127

mikade allegedly wrote:

Looks good. Now what we need next is option to show custom/variable sprite at cursor. That way we can finally have a more accurate editor and Construction Mode can look less hack-y, too.

AND "Level Editor" mission.

oh hi

if any staff is reading this, plz rename me to "h3oCharles", thx in advance

mikade
mikade's picture
User offline. Last seen 9 weeks 5 days ago. Offline
Joined: 2010-10-22
Posts: 355

KarBoy2314PL allegedly wrote:

mikade allegedly wrote:

Looks good. Now what we need next is option to show custom/variable sprite at cursor. That way we can finally have a more accurate editor and Construction Mode can look less hack-y, too.

AND "Level Editor" mission.

Well, yeah. I imagine it could be used in the level editor script I linked to -> http://hedgewars.org/node/6162. If I could get custom sprites at cursor (I think sheepluva was working on this) I'd be happy to do some updates.

mikade
Hedgewars Developer

Copyright © 2004-2023 Hedgewars Project. All rights reserved. [ contact ]