Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / sprite wont move

Author
Message
dax24
21
Years of Service
User Offline
Joined: 2nd Feb 2004
Location:
Posted: 7th Apr 2004 17:51
hi people, i have managed to do the collision code (thanks to Scouseknight) and i have loaded my tiles and sprite in but when i try to move the sprite using the arrowkeys he will move left 1 pixel but will not move in any other direction.

can anyone help me out with my code?
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 7th Apr 2004 18:54 Edited at: 7th Apr 2004 19:04
hmm havent had much time to study this but Id do some error checking as youve got alot of if statements in there.

maybe set centre = 1

and rem out: if centrex#=centrex and centrey#=centrey
centre = 1
endif

and just set levelup = 1
leveldown= 1
levelleft= 1
levelright= 1

plus move down : gosub _player_movement out of the if loop

atleast this way you know you should be able to move no matter what. If you can then you know youve got a funny in the code at the top that decides if theres an object in the way

i'm sure some other bright spark will be able to help. I'll try and look tonight when ive got more time to run the code and see

Morly

Morloc
dax24
21
Years of Service
User Offline
Joined: 2nd Feb 2004
Location:
Posted: 7th Apr 2004 19:24
i did what you said and it made the sprite move with no problems but now the collision dont work.

any ideas?
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 8th Apr 2004 00:33
ok thats good as you know that your movement code is fine. I just havent the time to go through your code in detail atm but I suggest you go through it step by step , put a few print statements in just to see what the values are.

get it to print on screen the values for centre, levelup,leveldown,levelleft,levelright etc.

these seem to be the key requirement to allow your code to work. so if you can get these to be what you think they should be then all should work. This is a good method for error checking, even put a few wait key statements in just to pause the loop to access if all is ok. Also put more rems in , in my eyes you can never have enough rems. You can always take them out at the end.

hope that helps

Morly

Morloc

Login to post a reply

Server time is: 2025-08-09 02:12:37
Your offset time is: 2025-08-09 02:12:37