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! / Changing Sprite Position / A Few Things To Talk About

Author
Message
JNice013
22
Years of Service
User Offline
Joined: 10th Jan 2004
Location:
Posted: 30th Apr 2004 03:10
OK here is what I have so far

Now I am trying to input running but I start the sprite off at about center screen all the way to the the left but when space key is pressed the sprite changes like it's suppose to but at the top left of the screen. I changed the x and y of the sprite to where the starting one is placed but that won't work because when moving the sprite needs to change and be in the position of where ever the player moved to and that is what I can't figure out. I know that the code is something like the name of the sprite or image and X plus one or minus one. That is what I am trying to get.

Also I have seen alot of posts in this thread about things related to this such as collision and background scrolling. Thier should be a sticky with all of these questions answered all in one topic like the Tutorial On 2D Shoot Em Ups by Reaperman. I am looking at the code from that to implement into my shooting platformer. If I knew all the answers to these questions I would post it all in one topic for everyone to look at and learn from but since I don't I come here to ask for help and comments. So maybe someone that has been here alot longer will make a topic that will answer these 2d questions because it seems as if alot of people have trouble with them. I am one to say and I know alot of people agree with this the codes staright from the manual don't explain clearly enough how to use them. Example : KEYSTATE() SYNTAX : Retirn Value=KEYSTATE(scancode).
I look at that and I ask do I put the return value part in or leave it out ( I Know Now Just An Example ). It shows the basic code of it but not it used fully or an example of it being used. Enough of me rambling this is just my opinion.

Thanks to anyone if they can help answer my question

"The Infamous J Nice"
Morloc
22
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 30th Apr 2004 20:26
Not sure if i totally understand but you want a character on screen that when you press a direction he/she moves in that direction and also animates while moving?

going from your snippet you dont want all those get image commands in the loop. you need to understand sprite 1,x,y,(frame)

so load lots of movement images in the top of code outside main loop. you then need to set up different if statements handling the movement that then gousubs to the directions ie

moveright:
x++ rem increment x
sprite x,y,frame
frame++
if frame = 5 then frame = 0 (sets frame loop back to beginning if theres say 5 frames of animation

hopefully thats a start

Morloc

Morloc

Login to post a reply

Server time is: 2026-06-09 13:56:16
Your offset time is: 2026-06-09 13:56:16