Moving Hotspot

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Moving Hotspot

Postby juhuwoorps » Sat Nov 22, 2008 5:42 pm

Hi at all.

I'm using the following code to move a hotspot:

Frame properties:
Code: Select all
x=377
y=141

This are the starting coordinates of the hotspot

My procdure:
Code: Select all
sub test(hotspotnumber,xend,yend)
If x>xend and y>yend Then
Hotspot(hotspotnumber).Move x*15,y*15
x=x-5
y=y-5
End If
End Sub


Hotspot Advanced Tab:
Code: Select all
Action.CreateTimedEvent 0.03,"test 2,50,50",true


Ok.This works fine for me.

Now I'm thinking to do this with a plugin, but the problem is I don't know how to handle the timed event.

All I have that the hotspot jumps to the coordinates wich are given with the plugin but I want to have a slower move.

Any ideas?

thanks
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby ShadowHunter » Sat Nov 22, 2008 6:08 pm

Hi,

I don't see the point of a plugin for this but if you already started making an OCX you probably can use a simple timer control on your plugin control and pass also the interval speed as a property from AM to your OCX.

At each timer fire event calculate a new X-Y position just like you do now, pass the new coordinates to AM and move the hotspot using these values (seems like to much work for this task :wink:)

I learned these timers are very sloppy and fire with an resolution of 50~55 mS :shock:

Better is to use CPU ticks via GetTickCount or even better via QueryPerformanceFrequency (wicked accurate) :D

Good luck !

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby juhuwoorps » Sat Nov 22, 2008 7:57 pm

Ok.now I have this:

Plugin procedure:(This works!)
Code: Select all
sub zeit(hotspotnumber,xend)

Action.CreateTimedEvent 0.03,"test 2,100",true


End Sub
sub test(hotspotnumber,xend)

If x>xend Then
Hotspot(hotspotnumber).Move x*15,y*15
x=x-5

End If
End Sub


in the frame properties:
Code: Select all
x=324
y=183


in the plugin tab I give the hotspotnumber and the end coordinate for x.

Now the problem is, if I change the numbers in the timeevent into variables, the variables are not given to the test sub.
(This works not!)
Code: Select all
sub zeit(hotspotnumber,xend)
Action.CreateTimedEvent 0.03,"test hotspotnumber,xend",true
End Sub
sub test(hotspotnumber,xend)
If x>xend Then
Hotspot(hotspotnumber).Move x*15,y*15
x=x-5
End If
End Sub

If I try it like in the code above it works?

Why is it not working with variables?
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby mercedes » Sat Nov 22, 2008 8:33 pm

hi there...:)

I think u have to make a separate sub for it..

by the way i can't wait to see this in action..Just out of curiousity what are u making it for...did u have something in mind..? when creating it..

Peace..
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby juhuwoorps » Sat Nov 22, 2008 8:47 pm

Juhu! It works!
The only thing you can do is to move a hotspot left or right!
I'm looking forward to put some features on it!

I've done this because I used the code in the first post for some of my games, and the idea to do this with a plugin don't have leave me in peace.
I want to have an easy way to do this!

Here's the downloadlink:
http://www.swuttig.de/games/plugins/hotspotsmove.zip

Feel free to modify!

Greetings!
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby ShadowHunter » Sat Nov 22, 2008 9:50 pm

Heheh... sorry, I thought you were making an ActiveX plugin :oops:
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby Lyberodoggy » Sat Nov 22, 2008 10:49 pm

You could try to work on a plugin I was creating, you can find it here: http://www.adventuremaker.com/phpBB2/viewtopic.php?t=4334
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby mercedes » Sun Nov 23, 2008 1:49 am

I have read that thread..it looks like u didn't accomplish it..but in the end u did accomplish that feat..It works now..Only u didn't develope a plugin ..but the shooting feild demo worked for u right......?
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby juhuwoorps » Sun Nov 23, 2008 2:25 am

The Shootingfield demo just need one direction to move, but the plugin moves in 2 directions.
I had have a look at the plugin and it runs now, but not satisfying at the moment.
Perhaps Lybero has any ideas
juhuwoorps
Code Master
 
Posts: 622
Joined: Tue Jul 08, 2008 3:13 pm

Postby Lyberodoggy » Sun Nov 23, 2008 2:33 pm

Look again in the Plugins forum
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests