Just add your minimum value to the random number. Of course you would have to adjust the maximum passed to the rnd() function to compensate. x% = 5 + RND(10) would set x% to a number between 5 and 14 for example.
Thank Stewart and Hanzo, it works now.
For some reason, when I make the sprite bigger, it acts as if the sprite is at the top left corner of the bigger sprite. Do you know why?
I think you have to use sphome to to change the location a sprite rotates around. However from your description, it may be that you didn't set the flag in spcol that says to take scaling into account. Hard to say without code or a screenshot.
So when I make the sprite bigger, It's Spcollision point is the top-left corner. You can see from the picture that the spcollision isn't working on the top middle.
You should correct at least two things as follows.
#1:Write variables of your sprite coordinates for second and third arguments of BGGET.
#2:Return value of BGGET is certain character number of BG tile. Every BG tile has its own character number. You can confirm it with smile tool.
I guess you should write line 128 as follows.
IF BGGET(0,X,Y,1)==(the character number) THEN...
Ok, I'm trying to see if i'm understanding this correctly.
IF BGGET (0/layer,X,Y/the sprite's x and y positions,1/so that it registers the tiles in pixel form? something like that)==(24)/the tile I want it to do something on THEN...
If that's correct, the only problem i have is figuring out which tile it is.
I don't know how to use the smile tool to find the tile-number. On my the comment where it shows the game i'm making, the top door is the place i'm trying to use. it's position is 12,1(I'm pretty sure)
Could you see grp5 with smile tool?
If you find U and V coordinates of the BG tile on grp5, you will get the tile-number with the following formula.
N=(V DIV 16)*32+(U DIV 16)
For example, (U,V) of closed door tile are (64,432), and 868 is given by the formula.
It finally works! Thanks for your patience with me. But to go through the door, the sprite has to be in the exact center. Is there a way to make the sensing point wider?
Ok, when I do that, it dosen't do anything when the sprite hits the door.
(something happened with my posts, so now i have 17 left. I think it's because of slow internet)
I'm sorry for wasting your remaining posts for today.
I guess the vertical bars you typed are wrong.
Correct bar character is yielded by the key to A's immediate left on the keyboard.
No, I'm pretty sure i wasted your posts today. Helping me with stuff that you already know.
So I fixed that bar, but now its acting as if that command isn't there. Sorry for making you use all your posts on this, by the way. I'll make a new play journal sometime later, most likely asking a question.
(sorry for not asking until now, I've been busy. But anyways) could you tell me how to put something like
IF BUTTON==#UP THEN BGGET...
I already tried that, but it didn't work.
The reason I need this, is because when you come back to the main room, you go back through the door again.
I guess "IF BUTTON(2)==#UP THEN..." is correct.
"||" is a kind of logical operator.
A || B yields TRUE when either A or B are TRUE, and it yields FALSE when both A and B are FALSE.
Ok, when I put SPHOME just before spset, an error occurs, so I took that out.
Hopefully changing to the circle-pad didn't mess it up. I can change it back to the d-pad if needed.
And last, where would I put the IF BUTTON(2) == #UP THEN?
What's wrong about circle-pad?
Unfortunately it is hard for me to give you any suggestion about the position of BUTTON(2) because I haven't grasp the overall structure of your program.
There's nothing wrong with the circle-pad. I just thought you would have to change up the X DEF 16 stuff because of it.
I could give you a key for the game if you want. Just so you know, if you look at the code, it's messy.
Thanks! This helps a lot. My only questions are fairly simple. What are "!" marks for in the buttons area? And do the "&&" signs do the same thing as the "||" lines?
I'll be sure to put you in the credits.
"!=" stands for "not equal".
"(B AND #RIGHT)!=0" is almost same as "B==#RIGHT", but when you press RIGHT on D-pad and another button (e.g. A button) at the same time, the former can detect RIGHT press but the latter cannot.
Both "&&" and "||" are logical operators. The difference of them is as follows.
(TRUE && TRUE)==TRUE
(TRUE && FALSE)==FALSE
(FALSE && TRUE)==FALSE
(FALSE && FALSE)==FALSE
(TRUE || TRUE)==TRUE
(TRUE || FALSE)==TRUE
(FALSE || TRUE)==TRUE
(FALSE || FALSE)==FALSE
I'm sorry I misunderstood the boundary issue.
We should shift all boundaries in proportion to the arguments of SPHOME as follows.
(before correction)
IF X<0 THEN X=0
IF X>385 THEN X=385
IF Y<18 THEN Y=18
IF Y>225 THEN Y=225
(after correction)
IF X<8 THEN X=8
IF X>393 THEN X=393
IF Y<26 THEN Y=26
IF Y>233 THEN Y=233
Same as before, we should shift initial location of coins as follows.
(before correction)
SPOFS N,RND(383),16+RND(208)
(after correction)
SPOFS N,8+RND(383),24+RND(208)
Replace N with 2 to 5.
You seem to try to shrink boundaries in proportion to player size to avoid protrusion of enlarged player sprite.
However, I guess this challenge will yield the new issue, the collision detection between player and doors(stairs).
Ok, I'll do that.
I'll just set the grown sprite boundaries as something to fix in an "update" of the game. It's really slowing my progress of the game, so I'll work on it later.