|
Post by egotrip on Jul 13, 2013 16:24:49 GMT
I have a maze, with both deadly blocks and sprites. However, moving through it is impossible due to the super tight collision detection. Is there a way to loosen it up? I have tried the collision distance but that doesn't help.
Also is there any way to find out if a variable is divisible by a number, ie if x is divisible by 8? If not can you add that please?
Is it possible to change the colours of inks in the games? Palette switching would save a lot of RAM rather than having to use duplicate tiles in different colours, and being able to change the background on the fly would be useful too. (The help file does mention an INK command, but its doesn't seem to work, and seems to be copied into the help file from the speccy version)
|
|
|
Post by nra on Jul 13, 2013 19:12:04 GMT
Hello Egotrip, regarding DIV, try something as the manual says : DIVIDE Y BY 8 As for detection, you're thinking right--try either alignment or a timer var (CLOCK) to make it more controllable. I wish Jonathan would add either sprite mask or vertical collision parameter, yet it's just a wish yet
|
|
|
Post by Jonathan Cauldwell on Jul 14, 2013 18:22:27 GMT
Block collision detection is pretty tight and I can't think of a way to loosen it without rewriting that bit of the engine.
There's no palette switching I'm afraid, though it's something I may add one day. The COLOUR command is used to change the text ink colour, but that's all there is.
AS NRA says, you can use DIVIDE to see if a number is divisible by 8. So this code:
LET A = X DIVIDE A BY 8 MULTIPLY A BY 8 IF A = X .. ENDIF
should do the job.
|
|
|
Post by egotrip on Jul 14, 2013 19:20:27 GMT
thanks for the replies
|
|
|
Post by egotrip on Jul 16, 2013 13:40:39 GMT
DIVIDE does not work in the CPC version - are you sure it is included? It's not even in the manual.
|
|
|
Post by Jonathan Cauldwell on Jul 16, 2013 20:23:00 GMT
You could be right. I'll add it to the to-do list.
There should be another way to check if a number is divisible by 8. Try this:
LET A = X MULTIPLY A BY 32 IF A = 0 (number is divisible by 8) ENDIF
...and see if that does the trick.
Thinking about palette switching, you can do it with the ASM command if you really want - but be careful. The way to do it is like this:
ASM 62 ASM p ASM 1 ASM c ASM c ASM 205 ASM 50 ASM 188
where p is the palette entry (0-15) and c is the colour number.
|
|
|
Post by egotrip on Jul 17, 2013 18:22:12 GMT
That multiply trick seems to work. Thanks.
However it doesn't help me, because I need it to check if its divisible by 2 or 4, not 8.
|
|
|
Post by Jonathan Cauldwell on Jul 19, 2013 8:56:36 GMT
To check if a number is divisible by 4, multiply by 64. For 2, multiply by 128.
|
|