News:

Function Finder  Find all the functions within source code files

Main Menu

Puzzel Game

Started by ScottB, January 27, 2025, 02:52:23 PM

Previous topic - Next topic

ScottB

Here is the start of a small pipe puzzle game.
Once the pipes match a path you win.
I was wondering how to make graphics better.
They already are 3x3 pipes for each piece.
So how do I Stretch a graphic and rotate it the same.
each has 4-way rotation.
You can change tile number from 1 to say 1,2,3,ect...to get a new graphic. yes but
each must rotate 4 way like it already does. pipes just look square right now.

Any ideas..

Thanks

ScottB

 

kevin

#1
If you want to animate tiles then all you need do is create sprites from the tiles are that being animated (moved rotated/scaled whatever). 


The process would be something like this;


 User selects tile to rotate around

 --> scan the map for the what tiles are to be animated/moved. 

 -->  For each tile that is set to 1

 -----> compute start & ending map coordinates of this tile. So where is's coming from and where it's moving to.   

 -----> set the map to zero at this tiles starting location, as It's going to be drawn separately from the main screen.

 -----> Add each tile to a list of dynamic moving objects.  These objects would store the starting position of the tile and expected end position of the tile and the tile ID, but in this case there's only one tile type (that being 1).  

 

 During each screen refresh we draw the list / array of sprites.  Each time updating their new position / rotations / Scale accordingly before drawing it.  Do this until the sprite reaches the expected target position.  

 --->  When the sprite reaches the target, we draw the sprite in it's last position, just to make sure the player sees the tile animte all the way from from position A through to Position B on the map entirely

 --->  Write the end tile position back into the map

 --->  delete now unwanted dynamic sprite   



Existing Screen Shot of the code above:

ScottB

I sort of know what you mean.  Is there a way you can show me an example of this?
Thanks
ScottB

kevin

#3
What part ?

Here's a short example of using a list to manage a list of moving objects ( images / sprites)

Press the mouse button to create a moving object. The object will move from the RIGHT handle of the Mouse position to the left hand side of the mouse position.  It's movement will be in a semi circle, moving through 0 to 180 degrees.

PlayBASIC Code: [Select]
    setfps 60


type tAnimatedObject
X#,Y#
Angle#
Speed#
Colour
endtype

Dim object as tAnimatedobject list

do
cls

mx=mousex()
my=mousey()
mb=mousebutton()

if mb=1
Object = new tAnimatedobject

Object.Angle = 0
Object.Speed = 4.45
Object.Colour = rndrgb()
flushmouse
endif


print "press mouse to create dynamic object"

// draw a circle at mouse position
circle mx,my,50,true


for each object()

angle#=Object.Angle
// Animate object
object.X#=mx+cos(angle#)*100
object.Y#=my+sin(angle#)*100
circlec object.x#,object.y#,50,true,object.colour
angle#+=object.speed#
Object.Angle=angle#
print angle#
if (angle#>180) then Object = null
next
Sync
loop