Gamestudio Links
Zorro Links
Newest Posts
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AbrahamR), 717 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
how do I let camera.pen just go between 0 and 359? #411336
11/15/12 16:44
11/15/12 16:44
Joined: Nov 2012
Posts: 18
Germany
E
elevationmind Offline OP
Newbie
elevationmind  Offline OP
Newbie
E

Joined: Nov 2012
Posts: 18
Germany
Hi,

I have to write a programe for a labyrinth that shows me that the player has made a mistake if he looked in to the direction of a dead end. I wanted to implement it, that if the player is on x,y coords and his pen goes for example 15 < or > -15 than it would count as a mistake.

But the problem is that pen counter never stops - if you rotate in one direction it goes over -+360 to much bigger numbers, and because I can't say how players would move around and rotate I can't really programme it the way I wanted to.

So here is my question: is it possible to specify in the script that pen can be ONLY 0 to 359, so that 360 would be again 0 and -1 would be 359?

my.pan += clamp(my.pan, 0, 359); just gets me an endless rotation...


I would be really greatful for any help!

Cheers

EM

Re: how do I let camera.pen just go between 0 and 359? [Re: elevationmind] #411338
11/15/12 16:48
11/15/12 16:48
Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
Superku Offline
Senior Expert
Superku  Offline
Senior Expert

Joined: Sep 2003
Posts: 6,861
Kiel (Germany)
You almost got it right:

my.pan = clamp(my.pan+mouse_force.x*5*time_step,0,360);


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends
Re: how do I let camera.pen just go between 0 and 359? [Re: Superku] #411340
11/15/12 16:58
11/15/12 16:58
Joined: Nov 2012
Posts: 18
Germany
E
elevationmind Offline OP
Newbie
elevationmind  Offline OP
Newbie
E

Joined: Nov 2012
Posts: 18
Germany
Hey thx for the quick reply.

It almost works;)! But now one can't rotate past the 0, but gets stuck there.

Is it possible not to impair the rotation but still get the pen number reset?

Re: how do I let camera.pen just go between 0 and 359? [Re: elevationmind] #411342
11/15/12 17:03
11/15/12 17:03
Joined: Apr 2007
Posts: 3,751
Canada
WretchedSid Offline
Expert
WretchedSid  Offline
Expert

Joined: Apr 2007
Posts: 3,751
Canada
Pretty sure you want cycle() in this case!


Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com
Re: how do I let camera.pen just go between 0 and 359? [Re: WretchedSid] #411345
11/15/12 17:15
11/15/12 17:15
Joined: Nov 2012
Posts: 18
Germany
E
elevationmind Offline OP
Newbie
elevationmind  Offline OP
Newbie
E

Joined: Nov 2012
Posts: 18
Germany
Originally Posted By: JustSid
Pretty sure you want cycle() in this case!


exactly:)! 1000 Thx!


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1