After Star is finished talking, you could use arrow keys to catch Spike. When you couldn't see Spike anymore and he isn't captured yet and he hasn't escaped, he is hiding behind the variable blocks. You can't catch spike by hitting him with Star's hat. You have to hit him with Star's body. There are some extra seconds in the time so once Star stops talking you have 30 seconds to catch him.