RomanCenturion's Forum Posts

  • Do you mean the placement at a certain position?

    If so:

    System->create object at (x + MouseX - MouseX % 32,

    y + MouseY - MouseY % 32)

    where (x,y) is equal to the placement of your image's hotspot

    If you meant limiting the placement area then just add a condition to your event that ignores input from the mouse when it is within a certain area.

    System->compare (MouseX > 100)

    System->compare (MouseX < 500)

    System->compare (MouseY > 100)

    System->compare (MouseY < 500)

    You could also "cheat" and place a sprite in the area you want to limit construction to. Then use the condition:

    System->Mouse is over sprite

    I apologize if anything's wrong. My excuse - I started working with construct for the first time in several months yesterday.

  • Thank you! After a few tweaks I got it to work perfectly. Now all I have to do is set up a way to get obstacles and optimize it.

  • Thanks for the example, I modified it a little so that the square wouldn't rotate. I'm having a few issues making the motion rotate more than 90 degrees, but I should be able to figure that out. Thanks for your help.

    Edit: fixed the issue

    Edit2: While it worked in your .cap, I can't replicate it in my .cap. Here's mine: pathfinding.cap.

  • Okay, thanks about the sleep info R0J0hound.

    On another issue, I've been trying to implement various ways to make the sprite move, but none of them have been very successful. Either they don't work at all or they move too quickly(a second to get to their destination). I was wondering what you guys would think I should use. I'm using lists to store the info, but another way would be fine.

  • Thanks for the tips. Also, I am having timing issues. I import time and use time.sleep(1). This causes it to freeze the whole script before it executes and the script never starts. I have time.sleep under a while statement that happens after part of the script is run through. Any reason for this?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks, I was trying to make it so that the script wouldn't be running multiple times at once(I learned this in a different not well known programming language). Hopefully I'll complete it soon.

  • I'm writing a script using python for finding a path for the object to move to (I know the RTS movement works for this). It's not complete, and it probably isn't the best written. One problem I'm running into is that it seems to run through the script only once. It's not under any construct events. Here's what I have so far.

    #Pathfinding
    from math import sqrt
    d = sqrt(((unit.X-goal.X)**2)+((unit.Y-goal.Y)**2))
    findpath = 'false'
    if System.globalvar('start') == "yes":
    	findpath = 'true'
    if findpath == 'true':
    	findpath == 'false'
    	distance.SetText(d)
    	pX = unit.X
    	pY = unit.Y
    	listX = []
    	listY = []
    	listX.append(pX)
    	listY.append(pY)
    	whileloop = 'yes'
    	while whileloop == 'yes':
    		p1 = sqrt((((pX+1)- goal.X)**2)+ (((pY+1)-goal.Y)**2))
    		p2 = sqrt((((pX+1)- goal.X)**2)+ (((pY)-goal.Y)**2))
    		p3 = sqrt((((pX+1)- goal.X)**2)+ (((pY-1)-goal.Y)**2))
    		p4 = sqrt((((pX)- goal.X)**2)+ (((pY-1)-goal.Y)**2))
    		p5 = sqrt((((pX-1)- goal.X)**2)+ (((pY-1)-goal.Y)**2))
    		p6 = sqrt((((pX-1)- goal.X)**2)+ (((pY)-goal.Y)**2))
    		p7 = sqrt((((pX-1)- goal.X)**2)+ (((pY+1)-goal.Y)**2))
    		p8 = sqrt((((pX)- goal.X)**2)+ (((pY+1)-goal.Y)**2))
    		choice = min(p1,p2,p3,p4,p5,p6,p7,p8)
    		n = 0
    		if n == 0:
    			if p1 == choice:
    				choice = [pX+1,pY+1]
    				n = 1
    			elif p2 == choice:
    				choice = [pX+1,pY]
    				n = 1
    			elif p3 == choice:
    				choice = [pX+1,pY-1]
    				n = 1
    			elif p4 == choice:
    				choice = [pX,pY-1]
    				n = 1
    			elif p5 == choice:
    				choice = [pX-1,pY-1]
    				n = 1
    			elif p6 == choice:
    				choice = [pX-1,pY]
    				n = 1
    			elif p7 == choice:
    				choice = [pX-1,pY+1]
    				n = 1
    			elif p8 == choice:
    				choice = [pX,pY+1]
    				n = 1
    			else:
    				choice = [pX,pY]
    				n = 1
    		if n == 1:
    			listX.append(choice[0])
    			listY.append(choice[1])
    			pX = choice[0]
    			pY = choice[1]
    			n = 0
    		if pY == goal.Y and pX == goal.X:
    			whileloop = 'no'[/code:2buu5dmb]
    Thanks for any help.
  • I finally got it to work using what you said. It's kind of annoying having to have place the libraries in with the .cap though. The email.Generators errors aren't stopping it from working so I guess those aren't important. I think I'll attempt to get numpy in, but I'll probably need help. Thanks a lot for all your help!

    Edit: I have no idea where to start. I downloaded a .zip file and I'm not sure what to do after that. There's a lot of files.

    Edit 2: I just put import numpy into the test.py. Will this work? It made a library.

  • [quote:zpehgrok]

    Out of curiosity, what are you using numpy for?

    I didn't have a definite reason for using it. However, I was thinking of using matrices and matrix multiplication.

    [quote:zpehgrok]

    Any specifics on what isn't working?

    When i build the new executable, it doesn't work. I don't know if this is a reason why, but on the command line it says that the email.Generator and email.Iterators modules are missing once it has completed building it(py2exe). Doesn't say anything is wrong with cxfreeze, but that doesn't work either. I get this warning message, "WARNING: No match found for input: load aiml b" for both processes. I went through the rest of the tutorial and it didn't work in construct either. By the way, thanks for your help.

  • Unfortunately the aiml example isn't working for me. Also, my computer is having issues making the executables. Anyway, what should I place in "test.py" for numpy?

  • Hello! I'm just wondering how to use numpy in Construct. I know I have to put some files into the data\python folder, but I'm not sure what's needed. Thanks.

  • Sorry for taking so long, but I've been a little busy. Anyway, new graphics, a drag selection tool, slightly improved path finding(will be much better), and different effects are the main changes. I know that deselecting a group of units doesn't work well, if at all, and that there are no actions for groups of units. I will try to fix those, make groups form formations, and improve the path finding in the next version. Version is available here:

    http://www.box.net/shared/x2ynnfdcsh

  • You can run construct off of a USB on a computer with windows xp. I know that because that is what I'm doing right now(it still works when I take it in and out of the slot). However, I'm not sure that it would work for multiple computers. Have you tried installing it onto the USB on one of the university computers? I know that with some computers, they'll allow you to install to a drive even though they won't allow you to install to the main drive.

  • Thanks, after looking into it, I think both ways will work for what I need it too. I'll test them out and see which one works best. Thanks a lot!

  • Basically, I want to count how many objects (different objects and all their instances) have the variable "selected" set to "yes" and set the value of global variable "unitCount" to the amount counted. However, I don't want to add to the global variable each time "selected" is set to "yes" since it would make certain controls in my project more difficult to make. Any help is appreciated. If there is no way, please let me know. Thanks.