Sprite placement tweak

6 replies [Last post]
nemo
nemo's picture
User offline. Last seen 22 weeks 4 days 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 22 weeks 4 days 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

h3oCharles
h3oCharles's picture
User offline. Last seen 7 weeks 3 days ago. Offline
Joined: 2012-10-19
Posts: 140

This looks interesting...

oh hi

nemo
nemo's picture
User offline. Last seen 22 weeks 4 days 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 48 weeks 2 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

h3oCharles
h3oCharles's picture
User offline. Last seen 7 weeks 3 days ago. Offline
Joined: 2012-10-19
Posts: 140

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

mikade
mikade's picture
User offline. Last seen 48 weeks 2 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

User login

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