You are going from an integral speed (2) to a fractional speed (2.5). So you are no longer aligning to the playing "grid", which your original code was probably focused on. So you just need to code things so it doesn't matter what speed you're actually going at as long as you have some way of aligning everything to that grid. Without looking at your code, since you're using D&D, I'd assume you have something along the lines of checking if there is no collision in the direction Pac-man wants to go. Well, let's assume each wall is 32x32p in size, in which case Pac-Man would be able to change direction every 32 pixels. Simply math shows 32/2=16, so at your old speed it would take Pac-Man 16 steps to traverse one wall-length. However, 32/2.5=12.8, which means after 12 steps Pac-Man won't have moved far enough (and will thus run into a wall) and after 13 steps he will have moved too far (and thus run into a wall). Thus, the only perfect solution is a speed of 1 or an integer easily divisible into the size of your walls. You could have speeds less than 1, just prevent Pac-man from actually moving at a fraction of a pixel -- or rather, don't let those fractions affect his fundamental mechanics. With speeds greater than 1, you need to make sure the speed is easily divisible into the size of your wall AND don't let fractional speeds affect fundamental movement. For example, a speed of 4/3 is divisible into 32 since 32/(4/3)=24, but because of floating point issues, if you include that "/3" in actual pixel positioning, then you will never be lined up with the grid properly, meaning even when it looks like Pac-Man's not blocked by any walls, there's a teensy-weensy fraction of a pixel actually blocked by a wall. But disregarding that nitpick for now, the easiest way to determine what speeds you can use is to write your desired speed out as a normal fraction, like 5/2 instead of 2.5; then look at the numerator. Is the numerator easily divisible into your wall width? If not, that's not a valid speed. Just at a glance, 2.5 seems like it should work with a 32x32 wall, but rewriting it, we see that 32 is clearly not easily divided by 5. This could take a while to sort through all the speeds, so just divide the size of your walls by 2 and use that as the numerator.
32 / 2 = 16
Any speed with 16 in the numerator should be valid. The baseline speed was 2 and 16/2=8, so any fraction with a denominator less than 8 should work. The closest values to 2.5 are 16/7 (2.285) and 16/6 (2.666), which can be reduced to 8/3. So with either of those speeds and proper handling of fractional coordinates, Pac-Man will be guaranteed to land on the 32x32 intervals.