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! / Isometric sprite problem

Author
Message
Little Steve
19
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Gateshead
Posted: 3rd Jan 2007 15:26
Hi,

I've had a look round the forums and cant seem to find anything to answer my current problem,

I've got 8 bitmap images of a car in isometric style each one showing the car pointed at different angles, as the left or right key is pressed the image number is incremented to show the car from a different side i.e as if it was turning.
But when I use the velocity command the car always goes straight up and not at the angle the image is showing the car pointing, I assume its because the sprite is not rotated just the image giving the impression of a different direction.

And this is where i'm stuck, I have the spriteangle# in the code which increments as the car is turned as apropriate so I know which angle the movement should go, I just dont know how to tell it to go that way.

Any advise would be great,

Thanks in advance
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 3rd Jan 2007 21:54
Try out using "cos" and "sin", as to find the values for "x" and "y"...

Hope something like this helps to get a grasp of it...



If ya need more help, i advice you to show at least some of the code you're working on...

Further on my stuff at...
Sven B
21
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 4th Jan 2007 11:36 Edited at: 4th Jan 2007 11:38
Because it is isometric style, you probably won't achieve a good effect if you use 360 degree turning...

You see, your car is probably point along a line with a slope of 1/2 (if it moves 2 units to the right, it moves 1 unit up) or -1/2.

This means that:
if upkey() > 0
x# = x# + (cos(30)*velocity)
y# = y# + (sin(30)*velocity)
endif
-- (cos(30) = sin(30)*2) --
or

if upkey() > 0
x# = x# + velocityX
y# = y# + (velocityX/2)
endif

the left, right and down are quite the same, but instead you have at least 1 - instead of +.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
Little Steve
19
Years of Service
User Offline
Joined: 2nd Jan 2007
Location: Gateshead
Posted: 4th Jan 2007 22:26
Thanks for the advice guys, I'm going to try using the cos / sin ideas and see if I can work it out.

Login to post a reply

Server time is: 2026-07-05 01:11:21
Your offset time is: 2026-07-05 01:11:21