Problem using sprite animation
Problem using sprite animation
Problem using sprite animation
Problem using sprite animation
Problem using sprite animation
Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation
Problem using sprite animation Problem using sprite animation
Problem using sprite animation
Go Back  Xtreme Visual Basic Talk > > > Problem using sprite animation


Reply
 
Thread Tools Display Modes
  #1  
Old 05-18-2009, 05:46 PM
Krb686 Krb686 is offline
Newcomer
 
Join Date: Apr 2009
Posts: 2
Default Problem using sprite animation


Im sure this is an easy fix, but im just getting into using sprites. Im using a link sprite sheet for a small rpg im creating for my programming class, and the problem im having is with the sword slash animation. Ive got him walking around fine, but when i do a sword slash to the left, instead of the sword moving to the left, the sword stays in place and link moves to the right. This is because the image in paint is wrapped to fit the edges of link's body, but with the picturebox's autosize property, it autosizes from left to right when the wider image is placed. Basically, i need a way of fixing this.

The two ways i can think of fixing this so far are to either:

1) simultaneously move the picturebox to the left while the sword is slashing or

2) creating the image so that it is not wrapped around link, and there is basically a buffer distance that is the distance of the sword at full length.

However both of these solutions will create problems when i make the boundaries for link's movement.

My idea for creating boundaries was going to be looking up the coordinates of the regions on the map where i dont want the character to go, and then setting restrictions, but with the 1st solution, the sword slash wouldnt work because the picbox wouldnt be able to move to the left if link walked up to a left boundary and then slashed. With the 2nd solution, the picbox would be extended the length of the sword past links body, so the real boundary would be slightly to the right of the object......
Reply With Quote
  #2  
Old 05-18-2009, 08:52 PM
vb5prgrmrProblem using sprite animation vb5prgrmr is offline
Senior Contributor

* Expert *
 
Join Date: Mar 2009
Posts: 1,087
Default

Whew!

Easiest way is to make sure all your images are the same size...

Good Luck
Reply With Quote
  #3  
Old 05-21-2009, 12:25 PM
Euroclydon's Avatar
Euroclydon Euroclydon is offline
Regular
 
Join Date: May 2009
Location: Northern Indiana, USA
Posts: 70
Default

If you're trying to keep your images small, you'll need to use offsets.
You could use a 3-dimension array, where the first is an index referencing a specific sprite, the last two being the X and Y offsets for positioning.

Add the X/Y offset to the Left/Top property of your Picture Box. I. E. "Adding" an X offset of -16 moves the box 16 units to the left of your character's location. This approach works best with the Pixel measurement system.

So long as the hero's location is in a variable, offsetting can be applied in the same code that moves him and/or changes the frame. He'll still be "standing" in the same place, regardless of where the image's top left corner is.

All at the cost of some simplicity, of course. If using large images isn't a problem, then by all means add a buffer around all the sprites and use the same offset for all.

If your map is divided into equal tiles, you can use an array for that, too.
If you set it up on an X,Y system, the Byte data type works very well.
Set a tile to 0 for walkable areas, and 1 for impassable tiles. Then you just have to track which tile the hero currently resides in. Numbers 2-255 can also be used for cool effects like water.

X/Y values convert easily to actual graphic tiles: multiply by the width/height of your tiles.

The tile system is one of the simplest ways to work. Sometimes, simple is best. I have lots of games from the mid-90's that use one.

Thanks for listening!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Problem using sprite animation
Problem using sprite animation
Problem using sprite animation Problem using sprite animation
Problem using sprite animation
Problem using sprite animation
Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation Problem using sprite animation
Problem using sprite animation
Problem using sprite animation
 
Problem using sprite animation
Problem using sprite animation
 
-->