Post by OW on Jul 13, 2009 17:22:31 GMT -5
Current help needed: Transforming Sprites
These images are pretty self-explanatory, as to what they should b named.
stuff them in "data"
Ok, here's something I tried, and once you walk over the gun, it goes away, and so does mark.
I've tried different things, but I can't make mark transform into MarkHG. Help, please?
These images are pretty self-explanatory, as to what they should b named.
stuff them in "data"
Ok, here's something I tried, and once you walk over the gun, it goes away, and so does mark.
Code:
Textmode(text_buffered)
dim textures (TexStripFrames("data\street.png")-1) = LoadTexStrip ("data\street.png")
data 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 1
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
data 6, 6, 0, 6, 6, 6, 6, 6, 6, 6, 0
dim tiles(10)(10), x, y
for y = 0 to 10
for x = 0 to 10
read tiles(x)(y)
next
next
dim tile = NewTileMap(textures)
SprSetTiles(tiles)
SprSetZOrder(1)
SprSetSize(200,200)
'------------------------
dim xPlayer, wWin, yPlayer, hWin, alive, xSize, ySize
ResizeSpriteArea(Windowwidth(),WindowHeight())
xSize = 29
ySize = 29
dim Playfield(xSize-1,ySize-1)
xPlayer=Windowwidth()/2
yPlayer=WindowHeight()/2
wWin=Windowwidth()/2
hWin=Windowheight()/2
alive= true
dim Mark(ImageStripFrames("data\strain.png") - 1)
Mark = LoadImageStrip("data\strain.png")
dim MarkSpr = NewSprite(Mark(0))
SprSetZOrder(-1)
SprSetAnimSpeed(1)
SprSetParallax(true)
dim bullet(ImageStripFrames("data\bullet.png") - 1)
bullet = LoadImageStrip("data\bullet.png")
SprSetParallax(true)
dim MarkHG(ImageStripFrames("data\markgun.png") - 1)
MarkHG = LoadImageStrip("data\strain.png")
dim MarkHGspr = NewSprite(MarkHG(0))
dim HG(ImageStripFrames("data\handgun.png") - 1)
HG = LoadImageStrip("data\handgun.png")
dim HGspr = NewSprite(Hg(0))
SprSetParallax(true)
struc Szombie
dim alive
dim sprite
dim x
dim y
endstruc
x = Windowheight()
y = Windowwidth()
dim Zom(ImageStripFrames("data\zombie.png") - 1)
Zom = LoadImageStrip("data\zombie.png")
SprSetZOrder(1)
SprSetAnimSpeed(1)
SprSetParallax(true)
const numberofzombies = 1
dim i
dim Szombie Zombies(numberofzombies-1)
for i = 0 to arraymax(Zombies)
Zombies(i).sprite = newsprite(zom)
Zombies(i).alive = true
Zombies(i).x = rnd()%1000
Zombies(i).y = rnd()%1000
next
dim Speed# = 4
dim zSpeed# = 1
'------------------------------------
Function Angle#(x1#,y1#,x2#,y2#)
Return 180-ATN2D(x2#-x1#, y2#-y1#)
EndFunction
while (true)
bindsprite(markspr)
if alive then
if ScanKeyDown (VK_LEFT) then
xPlayer=xPlayer-Speed#
elseif ScanKeyDown (VK_RIGHT) then
xPlayer=xPlayer+Speed#
elseif ScanKeyDown(VK_UP) then
yPlayer=yPlayer-Speed#
elseif ScanKeyDown(VK_DOWN) then
yPlayer=yPlayer+Speed#
if xplayer < X+32 and Xplayer > X-32 then
if yplayer < Y+32 and Yplayer > Y-32 then
DeleteSprite(MarkSpr)
DeleteSprite(HGspr)
else
endif
endif
endif
endif
SprCameraSetPos(xPlayer-wWin,yPlayer-hWin)
SprSetPos(xPlayer,yPlayer)
SprSetAngle(Angle#(SprX()-SprCameraX(),SprY()-SprCameraY(),Mouse_X()*windowwidth(),Mouse_Y()*windowheight()))
bindsprite(HGspr): SprSetPos(X,Y)
for i = 0 to arraymax(Zombies)
bindsprite(Zombies(i).sprite)
if zombies(i).alive then
if xPlayer > zombies(i).x then
Zombies(i).x = Zombies(i).x + zSpeed#
elseif xPlayer < Zombies(i).X then
Zombies(i).X = Zombies(i).X - zSpeed#
endif
if yPLayer > Zombies(i).Y then
Zombies(i).Y =Zombies(i).Y + zSpeed#
elseif Yplayer < Zombies(i).Y then
Zombies(i).Y = Zombies(i).Y - zSpeed#
endif
if Zombies(i).X < xplayer+16 and Zombies(i).X > xplayer-16 then
if Zombies(i).Y < yplayer+16 and Zombies(i).Y > yplayer-16 then
alive = false
endif
endif
SprSetPos(Zombies(i).X,Zombies(i).Y)
SprSetAngle(Angle#(SprX()-SprCameraX(),SprY()-SprCameraY(),xPlayer*windowwidth(),yPlayer*windowheight()))
endif
next
DRAWTEXT()
if alive = false then
locate 10,19
print "game over"
ZSpeed#=9
endif
wend
'------------------------
I've tried different things, but I can't make mark transform into MarkHG. Help, please?