Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 10:31 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Done in Opus script
PostPosted: March 26th, 2008, 3:06 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
When I'm, bored--I play with my snake!!! :-)

This was done in OpusScript. It eats processor power if you move it too fast.

I have a clock version as well, but I got bored before I finished it, so it doesn't re-assemble itself when the cursor stops.


Attachments:
Drag.zip [1.8 MiB]
Downloaded 988 times

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi
Top
 Profile  
 
 Post subject:
PostPosted: March 27th, 2008, 11:57 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Cheers Sandyn,

Works brilliantly - very smooth snaking. BTW - It would make a great screen saver.

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject:
PostPosted: March 28th, 2008, 4:24 am 
Offline

Joined: December 29th, 2004, 12:00 pm
Posts: 230
Location: Auckland NZ
Opus: v 7.04
OS: xp & win7
well done!

_________________
Opus Pro 7.04 - win10


For this message mac has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 28th, 2008, 9:51 am 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
Thanks!!
The original idea came from the java clock which can be dragged around the screen (if you have seen it?) The numbers and hands follow the cursor, but in a delayed fashion, so the clock appears to break up as the cursor moves, then re-assembles itself when the cursor stops. I wanted to see if I could reproduce that in OpusScript.
The snake was the first stage to get objects to follow the cursor.
It's only a few lines of script, it uses an event handler and arrays. When the mouse moves, it's position is saved to the first element of the arrays, then the previous 12 positions are rippled back through the arrays, but an increasing delay is added to the setposition.
I then used the DW analogue clock demo and the script to create a draggable clock. This works fine. When the cursor moves, the face, numbers and hands follow the cursor, when it stops, the clock re-assembles......however when it is published, it grinds to a halt. I used some lazy programming, so I need to go back and try to optimise the program.
I also started to develop a game based on the snake, but Opus is not really suitable for this. With an average spec. PC, it soon runs out of power when you use event handlers which have a lot of calculations in the scripting . It's an interesting challenge.

The screen saver idea is very interesting!. Rather than using the mouse cursor position, random movement of the snake.

Sandy

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Lightening the calc load
PostPosted: March 28th, 2008, 10:43 pm 
Offline
Godlike
Godlike

Joined: November 12th, 2005, 1:56 am
Posts: 1474
Location: SFBay Area
Opus: OpusPro v9.0x, & Evol.
OS: Vista32
System: Core 2 duo 2Ghz, RAM 3GB, Nvidia Go 7700 - laptop
Sandyn

Thinking out loud...
would it make sense to create a Frame, or a Rollover or Hotspot object for that matter... that on MouseOver activates your script. Makes for sort of "an active zone". Then move that zone along as well.

I would assume you could also put a Wait state or ticker/loop to reduce the sampling and monitoring?

You're right... even on a somewhat modern machine, it's easy to outrace the CPU. Nice work on the effects with slower mouse excursions.

_________________
_good things come to those who wait(0)_


For this message Lar_123 has been thanked by : mackavi


Top
 Profile  
 
 Post subject:
PostPosted: March 28th, 2008, 11:06 pm 
Offline

Joined: November 25th, 2004, 1:24 pm
Posts: 512
Location: Scotland
Opus: 9.75
OS: Win 10
System: Asus i7-7700K 16Gb
Thanks for some good ideas. One method I had thought of was to use the event handler to increment a counter, then when the counter reaches 10, run the script. Effectively dividing the event handler by 10. It's a trade off between smooth response and CPU usage.

I don't understand why it runs slower when published??

Sandy

_________________
Whoever designed this, never actually used it!


For this message sandyn has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 11 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group